Skip to content

Commit

Permalink
Update SidebarWrapper props type and add SidebarConfig type
Browse files Browse the repository at this point in the history
  • Loading branch information
vvu060 committed Jan 19, 2024
1 parent d165464 commit dbe3e01
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/theme/DocRoot/Layout/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ const CustomSearch = () => {
}

// Wrapper component combining Sidebar with CustomSearch
const SidebarWrapper = (props) => {
const SidebarWrapper = (props: SidebarConfig) => {
console.log({props})
return (
<div className="sidebar-search-container flex flex-col">
<CustomSearch />
Expand Down
34 changes: 33 additions & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type MoreFeatures = {
type Social = {
id: number
name: string
image?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
image?: FunctionComponent<SVGProps<SVGSVGElement>> | undefined
href: string
}

Expand Down Expand Up @@ -83,3 +83,35 @@ type RadioOptions = {
name: string
value: string
}

type SidebarLink = {
type: "link"
label: string
href: string
docId: string
unlisted: boolean
}

type SidebarCategory = {
type: "category"
label: string
collapsible: boolean
collapsed: boolean
items: SidebarLink[]
}

type SidebarItem = {
type: "category" | "link"
label: string
collapsible?: boolean
collapsed?: boolean
items?: SidebarLink[]
href?: string
docId?: string
unlisted?: boolean
}

type SidebarConfig = {
sidebar: SidebarItem[]
hiddenSidebarContainer: boolean
}
8 changes: 8 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@
"compilerOptions": {
"jsx": "react",
"baseUrl": ".",
"strict": true, // Enable all strict type checking options
"noImplicitAny": true, // Raise error on expressions and declarations with an implied 'any' type
"strictNullChecks": true, // When type checking, take into account 'null' and 'undefined'
"strictFunctionTypes": true, // Ensure function parameter and return type matching is more accurate
"strictBindCallApply": true, // Enable stricter checking of the 'bind', 'call', and 'apply' methods
"strictPropertyInitialization": true, // Ensure class properties are initialized in the constructor
"noImplicitThis": true, // Raise error on 'this' expressions with an implied 'any' type
"alwaysStrict": true, // Parse in strict mode and emit "use strict" for each source file
},
}

0 comments on commit dbe3e01

Please sign in to comment.