From e7575ab1188f87d07a6aa25cf76edf56737c7cc0 Mon Sep 17 00:00:00 2001 From: shervinchen Date: Sun, 16 Jun 2024 22:15:26 +0300 Subject: [PATCH] refactor: get sidebar data from json --- data/sidebars.ts | 140 --------------------------------- src/app/components/sidebar.tsx | 2 +- src/app/sidebars.json | 140 +++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+), 141 deletions(-) delete mode 100644 data/sidebars.ts create mode 100644 src/app/sidebars.json diff --git a/data/sidebars.ts b/data/sidebars.ts deleted file mode 100644 index c583dd2..0000000 --- a/data/sidebars.ts +++ /dev/null @@ -1,140 +0,0 @@ -export const SIDEBARS = [ - { - name: 'guide', - children: [ - { - name: 'Getting Started', - children: [ - { - name: 'Introduction', - url: '/guide/introduction', - }, - { - name: 'Installation', - url: '/guide/installation', - }, - { - name: 'Server Render', - url: '/guide/server-render', - }, - ], - }, - { - name: 'Customization', - children: [ - { - name: 'Colors', - url: '/guide/colors', - }, - { - name: 'Theming', - url: '/guide/theming', - }, - { - name: 'Custom Styles', - url: '/guide/custom-styles', - }, - ], - }, - ], - }, - { - name: 'components', - children: [ - { - name: 'General', - children: [ - { - name: 'Button', - url: '/components/button', - }, - { - name: 'Icon', - url: '/components/icon', - }, - ], - }, - { - name: 'Layout', - children: [ - { - name: 'Grid', - url: '/components/grid', - }, - { - name: 'Layout', - url: '/components/layout', - }, - ], - }, - { - name: 'Data Entry', - children: [ - { - name: 'Button Group', - url: '/components/button-group', - }, - { - name: 'Checkbox', - url: '/components/checkbox', - }, - { - name: 'Input', - url: '/components/input', - }, - { - name: 'Radio', - url: '/components/radio', - }, - { - name: 'Select', - url: '/components/select', - }, - { - name: 'Toggle', - url: '/components/toggle', - }, - ], - }, - { - name: 'Data Display', - children: [ - { - name: 'Popover', - url: '/components/popover', - }, - { - name: 'Tooltip', - url: '/components/tooltip', - }, - ], - }, - { - name: 'Feedback', - children: [ - { - name: 'Loading', - url: '/components/loading', - }, - { - name: 'Modal', - url: '/components/modal', - }, - ], - }, - { - name: 'Navigation', - children: [ - { - name: 'Pagination', - url: '/components/pagination', - }, - { - name: 'Tabs', - url: '/components/tabs', - }, - ], - }, - ], - }, -]; diff --git a/src/app/components/sidebar.tsx b/src/app/components/sidebar.tsx index 0de5eaa..a14273d 100644 --- a/src/app/components/sidebar.tsx +++ b/src/app/components/sidebar.tsx @@ -2,7 +2,7 @@ import Link from 'next/link'; import { usePathname } from 'next/navigation'; -import { SIDEBARS } from '@/data/sidebars'; +import SIDEBARS from '../sidebars.json'; export default function Sidebar() { const pathname = usePathname(); diff --git a/src/app/sidebars.json b/src/app/sidebars.json new file mode 100644 index 0000000..8ef021d --- /dev/null +++ b/src/app/sidebars.json @@ -0,0 +1,140 @@ +[ + { + "name": "guide", + "children": [ + { + "name": "Getting Started", + "children": [ + { + "name": "Introduction", + "url": "/guide/introduction" + }, + { + "name": "Installation", + "url": "/guide/installation" + }, + { + "name": "Server Render", + "url": "/guide/server-render" + } + ] + }, + { + "name": "Customization", + "children": [ + { + "name": "Colors", + "url": "/guide/colors" + }, + { + "name": "Theming", + "url": "/guide/theming" + }, + { + "name": "Custom Styles", + "url": "/guide/custom-styles" + } + ] + } + ] + }, + { + "name": "components", + "children": [ + { + "name": "General", + "children": [ + { + "name": "Button", + "url": "/components/button" + }, + { + "name": "Icon", + "url": "/components/icon" + } + ] + }, + { + "name": "Layout", + "children": [ + { + "name": "Grid", + "url": "/components/grid" + }, + { + "name": "Layout", + "url": "/components/layout" + } + ] + }, + { + "name": "Data Entry", + "children": [ + { + "name": "Button Group", + "url": "/components/button-group" + }, + { + "name": "Checkbox", + "url": "/components/checkbox" + }, + { + "name": "Input", + "url": "/components/input" + }, + { + "name": "Radio", + "url": "/components/radio" + }, + { + "name": "Select", + "url": "/components/select" + }, + { + "name": "Toggle", + "url": "/components/toggle" + } + ] + }, + { + "name": "Data Display", + "children": [ + { + "name": "Popover", + "url": "/components/popover" + }, + { + "name": "Tooltip", + "url": "/components/tooltip" + } + ] + }, + { + "name": "Feedback", + "children": [ + { + "name": "Loading", + "url": "/components/loading" + }, + { + "name": "Modal", + "url": "/components/modal" + } + ] + }, + { + "name": "Navigation", + "children": [ + { + "name": "Pagination", + "url": "/components/pagination" + }, + { + "name": "Tabs", + "url": "/components/tabs" + } + ] + } + ] + } +]