Skip to content

A self-hosted media server and file management system

feat: navlinks

aminnausin7049aa5283a4
diff --git a/resources/js/components/cedar-ui/button-nav/NavButton.vue b/resources/js/components/cedar-ui/button-nav/NavButton.vue
index 13d0a03e..c5f7159d 100644
--- a/resources/js/components/cedar-ui/button-nav/NavButton.vue
+++ b/resources/js/components/cedar-ui/button-nav/NavButton.vue
@@ -1,21 +1,28 @@
<script setup lang="ts">
+import { ButtonIcon } from '../button';
import { cn } from '@aminnausin/cedar-ui';
-const props = defineProps<{ label?: string; colour?: string; active?: boolean }>();
-const activeColour = `ring-3 ring-inset ring-[0.1rem] dark:ring-0 ring-violet-500 dark:bg-violet-700 bg-white`;
+const props = defineProps<{
+ label?: string;
+ colour?: string;
+ active: boolean;
+}>();
</script>
<template>
- <button
- :id="'btn-nav-' + props.label"
+ <button-icon
+ :id="'btn-nav-' + label"
+ :variant="'ghost'"
:class="
cn(
- props.active ? activeColour : `dark:bg-primary-dark-800 bg-white`,
- 'flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg shadow-lg hover:bg-neutral-100 dark:text-neutral-100 dark:hover:bg-violet-700',
- 'transition-colors duration-300',
+ {
+ 'ring-primary dark:bg-primary-active hocus:ring-primary/70 ring-2 ring-inset dark:ring-0': active,
+ 'hocus:bg-foreground-4-hover bg-surface-2 hover:ring-0': !active,
+ },
+ 'dark:hocus:bg-primary-dark focus:bg-surface-2 size-8 shrink-0 rounded-lg shadow-lg',
)
"
- :aria-label="props.label"
+ :title="label"
>
- <slot name="icon"></slot>
- </button>
+ <slot />
+ </button-icon>
</template>
diff --git a/resources/js/components/cedar-ui/button-nav/NavLink.vue b/resources/js/components/cedar-ui/button-nav/NavLink.vue
index f514dd3e..ff37073c 100644
--- a/resources/js/components/cedar-ui/button-nav/NavLink.vue
+++ b/resources/js/components/cedar-ui/button-nav/NavLink.vue
@@ -1,22 +1,25 @@
<script setup lang="ts">
-import { RouterLink } from 'vue-router';
+import { ButtonIcon } from '../button';
import { cn } from '@aminnausin/cedar-ui';
-const props = defineProps<{ label?: string; colour?: string; URL: string | URL }>();
+
+const props = defineProps<{
+ label?: string;
+ colour?: string;
+ active?: boolean;
+ url?: string;
+ href?: string;
+}>();
</script>
<template>
- <router-link
- :id="'btn-nav-' + props.label"
- :to="props.URL"
- :class="
- cn(
- `dark:bg-primary-dark-800 bg-white`,
- 'flex h-8 w-8 shrink-0 items-center justify-center rounded-lg shadow-lg hover:bg-neutral-100 dark:text-neutral-200 dark:hover:bg-violet-700',
- 'transition-colors duration-300',
- )
- "
- :aria-label="props.label"
+ <button-icon
+ :id="'link-nav-' + label"
+ :to="url"
+ :href="href"
+ :variant="'transparent'"
+ :class="cn('hocus:bg-foreground-4-hover hocus:dark:bg-primary-dark hover:ring-primary bg-surface-2 size-8 shrink-0 rounded-lg shadow-lg dark:hover:ring-0', {})"
+ :title="label"
>
- <slot name="icon"></slot>
- </router-link>
+ <slot></slot>
+ </button-icon>
</template>
diff --git a/resources/js/components/cedar-ui/button-nav/index.ts b/resources/js/components/cedar-ui/button-nav/index.ts
new file mode 100644
index 00000000..5b952b41
--- /dev/null
+++ b/resources/js/components/cedar-ui/button-nav/index.ts
@@ -0,0 +1,2 @@
+export { default as NavButton } from './NavButton.vue';
+export { default as NavLink } from './NavLink.vue';
diff --git a/resources/js/components/panels/NavBar.vue b/resources/js/components/panels/NavBar.vue
index f8dc562f..8f2b4cac 100755
--- a/resources/js/components/panels/NavBar.vue
+++ b/resources/js/components/panels/NavBar.vue
@@ -1,16 +1,15 @@
<script setup lang="ts">
+import { NavButton, NavLink } from '@/components/cedar-ui/button-nav/';
import { getScreenSize } from '@/service/util';
import { useAuthStore } from '@/stores/AuthStore';
import { useAppStore } from '@/stores/AppStore';
import { storeToRefs } from 'pinia';
-import { drawer, type DrawerCloseReason } from '@aminnausin/cedar-ui';
+import { drawer } from '@aminnausin/cedar-ui';
import { ref } from 'vue';
import VideoSidebarDrawer from '@/components/drawers/VideoSidebarDrawer.vue';
import ToggleLightMode from '@/components/inputs/ToggleLightMode.vue';
import DropdownMenu from '@/components/pinesUI/DropdownMenu.vue';
-import NavButton from '@/components/cedar-ui/button-nav/NavButton.vue';
-import NavLink from '@/components/cedar-ui/button-nav/NavLink.vue';
import MaterialSymbolsLightHistory from '~icons/material-symbols-light/history';
import CircumFolderOn from '~icons/circum/folder-on';
@@ -80,63 +79,51 @@ const toggleVideoSidebar = (sidebar: 'folders' | 'history') => {
<section class="ml-auto flex flex-wrap items-center justify-end gap-1 sm:w-auto sm:max-w-sm sm:shrink-0 sm:flex-nowrap sm:justify-normal">
<span id="video-navbar" class="flex items-center gap-1 antialiased">
- <NavButton v-if="userData" @click="cycleSideBar('notifications')" :label="'notifications'" class="hidden">
- <template #icon>
- <CircumInboxIn height="24" width="24" />
- </template>
+ <NavButton v-if="userData" @click="cycleSideBar('notifications')" :label="'notifications'" class="hidden" active>
+ <CircumInboxIn height="24" width="24" />
</NavButton>
<NavButton
v-if="$route.name === 'home'"
@click="toggleVideoSidebar('folders')"
:label="'folders'"
- :active="selectedSideBar === 'folders'"
- :class="`ring-1 ring-gray-900/5`"
+ :active="selectedSideBar == 'folders'"
title="Toggle Folder List"
+ class="p-0"
>
- <template #icon>
- <CircumFolderOn height="24" width="24" />
- </template>
+ <CircumFolderOn height="24" width="24" />
</NavButton>
<NavButton
v-if="userData && $route.name === 'home'"
@click="toggleVideoSidebar('history')"
:label="'history'"
:active="selectedSideBar === 'history'"
- :class="`ring-1 ring-gray-900/5`"
title="Toggle Watch History List"
+ class="p-0"
>
- <template #icon>
- <MaterialSymbolsLightHistory height="24" width="24" />
- </template>
+ <MaterialSymbolsLightHistory height="24" width="24" />
</NavButton>
<NavButton
v-if="$route.name === 'dashboard'"
@click="cycleSideBar('dashboard', 'left-card')"
:label="'dashboard'"
:active="selectedSideBar === 'dashboard'"
- :class="`ring-1 ring-gray-900/5`"
title="Toggle Dashboard Menu"
+ class="p-0"
>
- <template #icon>
- <ProiconsMenu height="20" width="20" />
- </template>
+ <ProiconsMenu height="20" width="20" />
</NavButton>
<NavButton
v-if="$route.name === 'settings' || $route.name === 'preferences'"
@click="cycleSideBar('settings', 'left-card')"
:label="'settings'"
:active="selectedSideBar === 'settings'"
- :class="`ring-1 ring-gray-900/5`"
title="Toggle Settings Menu"
+ class="p-0"
>
- <template #icon>
- <ProiconsMenu height="20" width="20" />
- </template>
+ <ProiconsMenu height="20" width="20" />
</NavButton>
- <NavLink v-if="$route.name != 'home'" :label="'home'" :URL="'/'" :class="`ring-1 ring-gray-900/5`" title="Return to Home Library">
- <template #icon>
- <CircumMonitor height="24" width="24" />
- </template>
+ <NavLink v-if="$route.name != 'home'" label="home" to="/" title="Return to Home Library" class="p-0">
+ <CircumMonitor height="24" width="24" />
</NavLink>
</span>
<ToggleLightMode class="w-[68px] border border-gray-900/5 shadow-lg dark:hover:border-violet-600" />