From 5f17a7089d83ac9267509981c0d2976e488bdde5 Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Wed, 19 Jun 2024 13:29:13 +0800 Subject: [PATCH] feat: navbar links --- config/navbar-links.json | 9 +++++++++ docusaurus.config.ts | 16 +++------------- static/admin/config.yml | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 config/navbar-links.json diff --git a/config/navbar-links.json b/config/navbar-links.json new file mode 100644 index 0000000..136921f --- /dev/null +++ b/config/navbar-links.json @@ -0,0 +1,9 @@ +{ + "links": [ + { + "href": "https://github.com/AElfProject/AElf", + "label": "GitHub", + "position": "right" + } + ] +} diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 2b37ee3..2d2da90 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -2,6 +2,7 @@ import {themes as prismThemes} from 'prism-react-renderer'; import type {Config} from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; import footerLinks from "./config/footer-links.json"; +import navbarLinks from "./config/navbar-links.json"; const config: Config = { title: "AELF Docs", @@ -59,19 +60,8 @@ const config: Config = { alt: "aelf", src: "img/Logo.aelf.svg", }, - items: [ - { - type: "docSidebar", - sidebarId: "tutorialSidebar", - position: "left", - label: "Docs", - }, - { - href: "https://github.com/AElfProject/AElf", - label: "GitHub", - position: "right", - }, - ], + // @ts-expect-error + items: navbarLinks.links, }, footer: { style: "light", diff --git a/static/admin/config.yml b/static/admin/config.yml index afb960f..8aee2d0 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -81,4 +81,17 @@ collections: fields: - {label: Label, name: label, widget: string} - {label: Href, name: href, widget: string} - - {label: Icon, name: icon, widget: image, allow_multiple: false, required: false} \ No newline at end of file + - {label: Icon, name: icon, widget: image, allow_multiple: false, required: false} + - label: "Navbar Links" + name: "navbarlinks" + file: "config/navbar-links.json" + fields: + - label: Links + name: links + widget: list + collapsed: false + fields: + - {label: Label, name: label, widget: string} + - {label: To, name: to, widget: string, required: false} + - {label: Href, name: href, widget: string, required: false} + - {label: Position, name: position, widget: select, options: [left, right], default: left} \ No newline at end of file