From f7f3e35fcfb3fd701ecd9d96eb4123cd1c70f183 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 11 Nov 2024 01:45:12 +0530 Subject: [PATCH] feat: Add dropdown navbar items --- src/lib/components/DropdownNavMenu.svelte | 44 ++++++++++++ src/lib/components/Navbar.svelte | 83 +++++++++-------------- 2 files changed, 76 insertions(+), 51 deletions(-) create mode 100644 src/lib/components/DropdownNavMenu.svelte diff --git a/src/lib/components/DropdownNavMenu.svelte b/src/lib/components/DropdownNavMenu.svelte new file mode 100644 index 00000000..530b8582 --- /dev/null +++ b/src/lib/components/DropdownNavMenu.svelte @@ -0,0 +1,44 @@ + + + diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index fdf6d9da..0fcdcdaa 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -10,6 +10,8 @@ import { env } from '$lib/util/env'; import { dismissPromotion, getActivePromotion } from '$lib/util/promos/promo'; import { stateStore } from '$lib/util/state'; + import type { ComponentProps } from 'svelte'; + import DropdownNavMenu from './DropdownNavMenu.svelte'; import Privacy from './Privacy.svelte'; import Theme from './Theme.svelte'; @@ -21,42 +23,28 @@ isMenuOpen = !isMenuOpen; } - interface Link { - href: string; - title?: string; - icon?: string; - img?: string; - } + type Links = ComponentProps['links']; - let links: Link[] = [ + const githubLinks: Links = [ + { title: 'Mermaid JS', href: 'https://github.com/mermaid-js/mermaid' }, { - title: 'Documentation', - href: 'https://mermaid.js.org/intro/getting-started.html' + title: 'Mermaid Live Editor', + href: 'https://github.com/mermaid-js/mermaid-live-editor' }, { - title: 'Tutorial', - href: 'https://mermaid.js.org/ecosystem/tutorials.html' - }, - { - title: 'Mermaid', - href: 'https://github.com/mermaid-js/mermaid' - }, - { - title: 'CLI', + title: 'Mermaid CLI', href: 'https://github.com/mermaid-js/mermaid-cli' - }, - { - href: 'https://github.com/mermaid-js/mermaid-live-editor', - icon: 'fab fa-github fa-lg' } ]; - if (isEnabledMermaidChartLinks) { - links.push({ - href: 'https://mermaidchart.com', - img: './mermaidchart-logo.svg' - }); - } + const documentationLinks: Links = [ + { title: 'Getting started', href: 'https://mermaid.js.org/intro/getting-started.html' }, + { title: 'Tutorials', href: 'https://mermaid.js.org/ecosystem/tutorials.html' }, + { + title: 'Integrations', + href: 'https://mermaid.js.org/ecosystem/integrations-community.html' + } + ]; let activePromotion = $state(getActivePromotion()); @@ -94,7 +82,7 @@ {/if} -