Skip to content

A self-hosted media server and file management system

chore: clean up classes for nav buttons

aminnausin4294f220d9b4
diff --git a/resources/js/components/inputs/NavButton.vue b/resources/js/components/inputs/NavButton.vue
index 8d43f0c0..13d0a03e 100755
--- a/resources/js/components/inputs/NavButton.vue
+++ b/resources/js/components/inputs/NavButton.vue
@@ -1,16 +1,21 @@
<script setup lang="ts">
-import { ref } from 'vue';
+import { cn } from '@aminnausin/cedar-ui';
-const props = defineProps(['label', 'colour', 'active']);
-const activeColour = ref(`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 }>();
+const activeColour = `ring-3 ring-inset ring-[0.1rem] dark:ring-0 ring-violet-500 dark:bg-violet-700 bg-white`;
</script>
<template>
<button
:id="'btn-nav-' + props.label"
- :class="`${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`"
+ :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',
+ )
+ "
:aria-label="props.label"
>
<slot name="icon"></slot>
- <span :class="`hidden ${activeColour}`"></span>
</button>
</template>
diff --git a/resources/js/components/inputs/NavLink.vue b/resources/js/components/inputs/NavLink.vue
index 6d50df5c..f514dd3e 100755
--- a/resources/js/components/inputs/NavLink.vue
+++ b/resources/js/components/inputs/NavLink.vue
@@ -1,14 +1,20 @@
-<script setup>
+<script setup lang="ts">
import { RouterLink } from 'vue-router';
-const props = defineProps(['label', 'colour', 'URL', 'active']);
-const activeColour = `bg-neutral-300 dark:bg-violet-700`;
+import { cn } from '@aminnausin/cedar-ui';
+const props = defineProps<{ label?: string; colour?: string; URL: string | URL }>();
</script>
<template>
<router-link
:id="'btn-nav-' + props.label"
:to="props.URL"
- :class="`${props.active ? activeColour : `bg-white dark:bg-primary-dark-800`} hover:bg-neutral-100 dark:hover:bg-violet-700 dark:text-neutral-200 flex justify-center items-center shrink-0 h-8 w-8 rounded-lg shadow-lg`"
+ :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"
>
<slot name="icon"></slot>