From 456271cb228d33c96c55ba34b2d74590521fba76 Mon Sep 17 00:00:00 2001 From: Chiri Vulpes Date: Fri, 10 Jan 2025 11:23:52 +1300 Subject: [PATCH] Make Debug and account buttons links --- src/ui/component/Masthead.ts | 12 ++++++------ src/ui/component/Sidebar.ts | 5 +++-- style/component/core/button.chiri | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ui/component/Masthead.ts b/src/ui/component/Masthead.ts index 38cdbb1..7283a15 100644 --- a/src/ui/component/Masthead.ts +++ b/src/ui/component/Masthead.ts @@ -94,24 +94,24 @@ const Masthead = Component.Builder('header', (masthead, view: ViewContainer) => .append(Slot() .use(Session.Auth.author, (slot, author) => { if (!author) { - Button() + Link('/account') + .and(Button) .type('flush') .text.use('masthead/user/profile/popover/login') - .event.subscribe('click', () => navigate.toURL('/account')) .appendTo(slot) return } - Button() + Link(`/author/${author.vanity}`) + .and(Button) .type('flush') .text.use('masthead/user/profile/popover/profile') - .event.subscribe('click', () => navigate.toURL(`/author/${author.vanity}`)) .appendTo(slot) - Button() + Link('/account') + .and(Button) .type('flush') .text.use('masthead/user/profile/popover/account') - .event.subscribe('click', () => navigate.toURL('/account')) .appendTo(slot) })))) .appendTo(masthead) diff --git a/src/ui/component/Sidebar.ts b/src/ui/component/Sidebar.ts index 74ce219..d04ea33 100644 --- a/src/ui/component/Sidebar.ts +++ b/src/ui/component/Sidebar.ts @@ -1,5 +1,6 @@ import Component from 'ui/Component' import Button from 'ui/component/core/Button' +import Link from 'ui/component/core/Link' import Env from 'utility/Env' import Store from 'utility/Store' @@ -20,9 +21,9 @@ const Sidebar = Component.Builder('nav', (sidebar): Sidebar => { .ariaLabel.use('masthead/primary-nav/alt') if (Env.ENVIRONMENT === 'dev') - Button() + Link('/debug') + .and(Button) .text.set('Debug') - .event.subscribe('click', () => navigate.toURL('/debug')) .appendTo(sidebar) updateSidebarVisibility() diff --git a/style/component/core/button.chiri b/style/component/core/button.chiri index e22c36a..7d2baba 100644 --- a/style/component/core/button.chiri +++ b/style/component/core/button.chiri @@ -2,6 +2,7 @@ $$button-background!colour $$button-background-highlight!colour .button: + #after: .link %borderless %inline-block %padding-2-3 @@ -12,6 +13,7 @@ $$button-background-highlight!colour %font-family-inherit %font-4 %box-shadow-1 + %decoration-none colour: $button-colour $button-background: $background-interact-4 $button-background-highlight: hsl(from $button-background h s calc(l + 6))