This repository was archived by the owner on Sep 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +25
-24
lines changed Expand file tree Collapse file tree 3 files changed +25
-24
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { useColorModeValue } from '@chakra-ui/vue-next'
4
4
import { useRoute } from ' vue-router'
5
5
import { useLockScroll } from ' vue-composable'
6
6
import { SidebarContent } from ' ../components/Sidebar/AppSidebar.vue'
7
- import { getRoutes } from ' ../layout/LayoutMdx.vue '
7
+ import { getRoutes } from ' ../utils/get-routes '
8
8
9
9
export const MobileNavButton = (props : any , { slots }: SetupContext ) => (
10
10
<c-icon-button
Original file line number Diff line number Diff line change 9
9
10
10
<script lang="ts">
11
11
import { defineComponent , PropType } from ' vue'
12
- import docsSidebar from ' @/config/docs-sidebar.json'
13
- import guidesSidebar from ' @/config/guides-sidebar.json'
14
- import blogSidebar from ' @/config/blog-sidebar.json'
15
12
import { getHeadings } from ' @/docs-theme/utils/get-headings'
13
+ import { getRoutes } from ' @/docs-theme/utils/get-routes'
16
14
import { useRoute } from ' vue-router'
17
15
18
- export function getRoutes(slug : string ) {
19
- // for home page, use docs sidebat
20
- if (slug === ' /' ) return docsSidebar .routes
21
-
22
- const configMap = {
23
- ' /resources' : docsSidebar ,
24
- ' /changelog' : docsSidebar ,
25
- ' /guides' : guidesSidebar ,
26
- ' /blog' : blogSidebar ,
27
- ' /docs' : docsSidebar ,
28
- }
29
-
30
- const [_path, sidebar] =
31
- Object .entries (configMap ).find (([path , _sidebar ]) =>
32
- slug .startsWith (path )
33
- ) ?? []
34
-
35
- return sidebar ?.routes ?? []
36
- }
37
-
38
16
export default defineComponent ({
39
17
props: {
40
18
frontmatter: {
Original file line number Diff line number Diff line change
1
+ import docsSidebar from '@/config/docs-sidebar.json'
2
+ import guidesSidebar from '@/config/guides-sidebar.json'
3
+ import blogSidebar from '@/config/blog-sidebar.json'
4
+
5
+ export function getRoutes ( slug : string ) {
6
+ // for home page, use docs sidebat
7
+ if ( slug === '/' ) return docsSidebar . routes
8
+
9
+ const configMap = {
10
+ '/resources' : docsSidebar ,
11
+ '/changelog' : docsSidebar ,
12
+ '/guides' : guidesSidebar ,
13
+ '/blog' : blogSidebar ,
14
+ '/docs' : docsSidebar ,
15
+ }
16
+
17
+ const [ _path , sidebar ] =
18
+ Object . entries ( configMap ) . find ( ( [ path , _sidebar ] ) =>
19
+ slug . startsWith ( path )
20
+ ) ?? [ ]
21
+
22
+ return sidebar ?. routes ?? [ ]
23
+ }
You can’t perform that action at this time.
0 commit comments