feat(ui): Sidebar thick active links

This commit is contained in:
ArneBo 2024-12-19 10:45:55 +01:00 committed by upsiflu
parent 5032b2536b
commit 5f6d0c6bb2
2 changed files with 19 additions and 3 deletions

View File

@ -3,11 +3,11 @@ import { computed } from 'vue'
import { type RouterLinkProps, RouterLink } from 'vue-router' import { type RouterLinkProps, RouterLink } from 'vue-router'
import { type ColorProps, type DefaultProps, type VariantProps, propsToColor } from '~/composables/colors'; import { type ColorProps, type DefaultProps, type VariantProps, propsToColor } from '~/composables/colors';
const { to, icon, thin, round, ...colorProps } = defineProps<{ const { to, icon, thickWhenActive, round, ...colorProps } = defineProps<{
width?: 'standard' | 'auto' | 'full' width?: 'standard' | 'auto' | 'full'
alignText?: 'left' | 'center' | 'right' alignText?: 'left' | 'center' | 'right'
alignSelf?: 'start' | 'center' | 'end' alignSelf?: 'start' | 'center' | 'end'
thin?: true thickWhenActive?: true
icon?: string; icon?: string;
round?: true; round?: true;
@ -17,7 +17,7 @@ const isExternalLink = computed(() => {
return typeof to === 'string' && to.startsWith('http') return typeof to === 'string' && to.startsWith('http')
}) })
const fontWeight = thin ? 400 : 900 const [fontWeight, activeFontWeight] = thickWhenActive ? [600, 900] : [400, 400]
const isIconOnly = computed(() => !!icon) const isIconOnly = computed(() => !!icon)
const isSimple = propsToColor(colorProps).class === '' const isSimple = propsToColor(colorProps).class === ''
@ -71,6 +71,11 @@ const isSimple = propsToColor(colorProps).class === ''
font-family: $font-main; font-family: $font-main;
font-weight: v-bind(fontWeight); font-weight: v-bind(fontWeight);
&:global(.router-link-exact-active) {
font-weight: v-bind(activeFontWeight);
}
font-size: 0.875em; font-size: 0.875em;
line-height: 1em; line-height: 1em;

View File

@ -125,6 +125,7 @@ const uploads = useUploadsStore()
<Link to="/library" <Link to="/library"
ghost ghost
icon="bi-compass" icon="bi-compass"
thickWhenActive
> >
{{ t('components.Sidebar.header.explore') }} {{ t('components.Sidebar.header.explore') }}
</Link> </Link>
@ -132,6 +133,7 @@ const uploads = useUploadsStore()
<Link to="/library/artists" <Link to="/library/artists"
ghost ghost
icon="bi-person" icon="bi-person"
thickWhenActive
> >
{{ t('components.Sidebar.link.artists') }} {{ t('components.Sidebar.link.artists') }}
</Link> </Link>
@ -139,6 +141,7 @@ const uploads = useUploadsStore()
<Link to="/library/albums" <Link to="/library/albums"
ghost ghost
icon="bi-disc" icon="bi-disc"
thickWhenActive
> >
{{ t('components.Sidebar.link.albums') }} {{ t('components.Sidebar.link.albums') }}
</Link> </Link>
@ -146,24 +149,28 @@ const uploads = useUploadsStore()
<Link to="/library/playlists" <Link to="/library/playlists"
ghost ghost
icon="bi-music-note-list" icon="bi-music-note-list"
thickWhenActive
> >
{{ t('components.Sidebar.link.playlists') }} {{ t('components.Sidebar.link.playlists') }}
</Link> </Link>
<Link to="/library/radios" <Link to="/library/radios"
ghost ghost
icon="bi-boombox-fill" icon="bi-boombox-fill"
thickWhenActive
> >
{{ t('components.Sidebar.link.radios') }} {{ t('components.Sidebar.link.radios') }}
</Link> </Link>
<Link to="/library/podcasts" <Link to="/library/podcasts"
ghost ghost
icon="bi-mic" icon="bi-mic"
thickWhenActive
> >
{{ t('components.Sidebar.link.podcasts') }} {{ t('components.Sidebar.link.podcasts') }}
</Link> </Link>
<Link to="/favorites" <Link to="/favorites"
ghost ghost
icon="bi-heart" icon="bi-heart"
thickWhenActive
> >
{{ t('components.Sidebar.link.favorites') }} {{ t('components.Sidebar.link.favorites') }}
</Link> </Link>
@ -194,6 +201,10 @@ const uploads = useUploadsStore()
display:flex; display:flex;
flex-direction:column; flex-direction:column;
.logo {
margin: 16px;
}
&.sticky-content { &.sticky-content {
max-height: 100vh; max-height: 100vh;
overflow: auto; overflow: auto;