Skip to content

Commit

Permalink
Apidoc latest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Oct 6, 2023
1 parent 30bbdae commit b67a653
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
21 changes: 19 additions & 2 deletions assets/styles/layout/_doc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@
}
}

&.doc-option-parameter {
> .doc-option-parameter-scope {
font-weight: 500;
color: var(--surface-600);
}
}

&:first-child {
color: var(--primary-color);
font-weight: 700;
Expand Down Expand Up @@ -322,9 +329,9 @@
}
}

.doc-option-props {
.doc-option-default,
.doc-option-returnType {
display: flex;
background: var(--bluegray-50);
border-width: 1px;
border-style: solid;
border-radius: 6px;
Expand All @@ -343,6 +350,16 @@
}
}
}

.doc-option-light {
background: var(--bluegray-50);
border-color: var(--bluegray-100);
}

.doc-option-dark {
background: var(--bluegray-800);
border-color: var(--bluegray-800);
}
}
}
}
24 changes: 11 additions & 13 deletions components/doc/DocApiTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
<td
v-for="[k, v] in Object.entries(prop)"
:key="k"
:class="{ 'doc-option-type': k === 'type' || k === 'options', 'doc-option-default': k === 'defaultValue' }"
:class="{ 'doc-option-type': k === 'type' || k === 'options', 'doc-option-parameter': k === 'parameters' }"
:style="{ 'max-width': k === 'default' || k === 'returnType' ? '200px' : undefined }"
>
<template v-if="k !== 'readonly' && k !== 'optional' && k !== 'deprecated'">
<span v-if="k === 'name'" :id="id + '.' + v" class="doc-option-name" :class="{ 'line-through cursor-pointer': !!prop.deprecated }" :title="prop.deprecated">
{{ v }}<NuxtLink :to="`/${$router.currentRoute.value.name}/#${id}.${v}`" :class="['doc-option-link', optionLinkClass]"> <i class="pi pi-link"></i> </NuxtLink>
{{ v }}<NuxtLink :to="`/${$router.currentRoute.value.name}/#${id}.${v}`" class="doc-option-link"> <i class="pi pi-link"></i> </NuxtLink>
</span>

<template v-else-if="k === 'type'">
<template v-for="(value, i) in getType(v)" :key="value">
{{ i !== 0 ? ' | ' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" :class="['doc-option-link', optionLinkClass]">{{ value }}</NuxtLink
{{ i !== 0 ? ' | ' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link">{{ value }}</NuxtLink
><span v-else>{{ value }}</span>
</template>
</template>
Expand All @@ -46,18 +46,22 @@
</template>

<template v-else-if="k === 'parameters'">
<span v-if="v.name" :class="{ 'font-medium text-600': label === 'Slots' }"> {{ v.name }} : </span>
<span v-if="v.name" :class="{ 'doc-option-parameter-scope': label === 'Slots', 'doc-option-parameter-type': label === 'Emits' }"> {{ v.name }} : </span>
<template v-for="(value, i) in getType(v.type)" :key="value">
{{ i !== 0 ? ' | ' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" :class="['doc-option-link', optionLinkClass]"> {{ value }} </NuxtLink>
{{ i !== 0 ? ' | ' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link doc-option-parameter-name"> {{ value }} </NuxtLink>
<span v-else v-html="value"> </span>
</template>
</template>

<div v-else-if="k === 'default' || k === 'returnType'" :id="id + '.' + k" :class="['doc-option-props', optionPropClass]">
<div v-else-if="k === 'default'" :id="id + '.' + k" :class="['doc-option-default', $appState.darkTheme ? 'doc-option-dark' : 'doc-option-light']">
{{ v === '' || v === undefined ? 'null' : v }}
</div>

<span v-else :id="id + '.' + k"> {{ v }} </span>
<div v-else-if="k === 'returnType'" :id="id + '.' + k" :class="['doc-option-returnType', $appState.darkTheme ? 'doc-option-dark' : 'doc-option-light']">
{{ v }}
</div>

<span v-else :id="id + '.' + k" class="doc-option-description"> {{ v }} </span>
</template>
</td>
</tr>
Expand Down Expand Up @@ -165,12 +169,6 @@ export default {
}
return this.data[0].data ? 1 : 2;
},
optionLinkClass() {
return this.$appState.darkTheme ? 'text-primary-400' : 'text-primary-600';
},
optionPropClass() {
return this.$appState.darkTheme ? 'border-bluegray-800 bg-bluegray-800' : 'border-bluegray-100 bg-bluegray-50';
}
}
};
Expand Down

0 comments on commit b67a653

Please sign in to comment.