mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 09:37:43 +02:00
Add initial implementation of sidebar keys
This commit is contained in:
parent
222a077d85
commit
3a5010a83a
9 changed files with 349 additions and 34 deletions
|
@ -238,6 +238,7 @@ Available doc IDs:
|
|||
|
||||
return {
|
||||
type: 'category',
|
||||
key: categoryMetadata?.key,
|
||||
label: categoryMetadata?.label ?? categoryLinkedDoc?.label ?? filename,
|
||||
collapsible: categoryMetadata?.collapsible,
|
||||
collapsed: categoryMetadata?.collapsed,
|
||||
|
|
|
@ -19,6 +19,7 @@ import type {Slugger} from '@docusaurus/utils';
|
|||
type Expand<T extends {[x: string]: unknown}> = {[P in keyof T]: T[P]};
|
||||
|
||||
export type SidebarItemBase = {
|
||||
key?: string;
|
||||
className?: string;
|
||||
customProps?: {[key: string]: unknown};
|
||||
};
|
||||
|
@ -215,6 +216,7 @@ export type PropSidebarBreadcrumbsItem =
|
|||
| PropSidebarItemCategory;
|
||||
|
||||
export type CategoryMetadataFile = {
|
||||
key?: string;
|
||||
label?: string;
|
||||
position?: number;
|
||||
description?: string;
|
||||
|
|
|
@ -28,6 +28,7 @@ import type {
|
|||
// in normalization
|
||||
|
||||
const sidebarItemBaseSchema = Joi.object<SidebarItemBase>({
|
||||
key: Joi.string().optional(),
|
||||
className: Joi.string(),
|
||||
customProps: Joi.object().unknown(),
|
||||
});
|
||||
|
@ -166,6 +167,7 @@ export function validateSidebars(sidebars: {
|
|||
}
|
||||
|
||||
const categoryMetadataFileSchema = Joi.object<CategoryMetadataFile>({
|
||||
key: Joi.string(),
|
||||
label: Joi.string(),
|
||||
description: Joi.string(),
|
||||
position: Joi.number(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue