web/settings: highlight the setting when linked to

- remade the way padding in settings is done to accommodate space for a highlight
- renamed nav components to indicate better what they are
This commit is contained in:
wukko 2024-07-07 21:51:46 +06:00
parent 430bfaca43
commit d22230b1d5
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
4 changed files with 65 additions and 20 deletions

View file

@ -1,10 +1,24 @@
<script lang="ts"> <script lang="ts">
import { page } from "$app/stores";
export let sectionId: string; export let sectionId: string;
export let title: string; export let title: string;
export let description: string = ""; export let description: string = "";
let animate = false;
$: hash = $page.url.hash.replace("#", "");
$: if (hash === sectionId) {
animate = true;
}
</script> </script>
<section id={sectionId} class="settings-content"> <section
id={sectionId}
class="settings-content"
class:animate
>
<h3 class="settings-content-title">{title}</h3> <h3 class="settings-content-title">{title}</h3>
<slot></slot> <slot></slot>
@ -18,5 +32,32 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
padding: calc(var(--settings-padding) / 2);
border-radius: 18px;
}
.settings-content.animate {
animation: highlight 2s;
}
@keyframes highlight {
0% {
box-shadow: none;
}
10% {
box-shadow: 0 0 0 3.5px var(--blue) inset;
}
20%, 50% {
box-shadow: 0 0 0 3px var(--blue) inset;
}
100% {
box-shadow: none;
}
}
@media screen and (max-width: 750px) {
.settings-content {
padding: var(--padding);
}
} }
</style> </style>

View file

@ -3,8 +3,8 @@
import { t } from "$lib/i18n/translations"; import { t } from "$lib/i18n/translations";
import SettingsTab from "$components/settings/SettingsTab.svelte"; import SettingsNavTab from "$components/settings/SettingsNavTab.svelte";
import SettingsSection from "$components/settings/SettingsSection.svelte"; import SettingsNavSection from "$components/settings/SettingsNavSection.svelte";
import IconSunHigh from "@tabler/icons-svelte/IconSunHigh.svelte"; import IconSunHigh from "@tabler/icons-svelte/IconSunHigh.svelte";
@ -68,38 +68,38 @@
{/if} {/if}
</div> </div>
<nav id="settings-navigation" class:visible-mobile={isMobile && isHome}> <nav id="settings-navigation" class:visible-mobile={isMobile && isHome}>
<SettingsSection sectionTitle="general"> <SettingsNavSection sectionTitle="general">
<SettingsTab <SettingsNavTab
tabName="appearance" tabName="appearance"
tabLink="general/appearance" tabLink="general/appearance"
iconColor="blue" iconColor="blue"
> >
<IconSunHigh /> <IconSunHigh />
</SettingsTab> </SettingsNavTab>
</SettingsSection> </SettingsNavSection>
<SettingsSection sectionTitle="save"> <SettingsNavSection sectionTitle="save">
<SettingsTab <SettingsNavTab
tabName="video" tabName="video"
tabLink="save/video" tabLink="save/video"
iconColor="green" iconColor="green"
> >
<IconMovie /> <IconMovie />
</SettingsTab> </SettingsNavTab>
<SettingsTab <SettingsNavTab
tabName="audio" tabName="audio"
tabLink="save/audio" tabLink="save/audio"
iconColor="green" iconColor="green"
> >
<IconMusic /> <IconMusic />
</SettingsTab> </SettingsNavTab>
<SettingsTab <SettingsNavTab
tabName="metadata" tabName="metadata"
tabLink="save/metadata" tabLink="save/metadata"
iconColor="green" iconColor="green"
> >
<IconFileSettings /> <IconFileSettings />
</SettingsTab> </SettingsNavTab>
</SettingsSection> </SettingsNavSection>
</nav> </nav>
</div> </div>
@ -120,15 +120,13 @@
grid-template-columns: var(--settings-nav-width) 1fr; grid-template-columns: var(--settings-nav-width) 1fr;
overflow: hidden; overflow: hidden;
padding-left: var(--settings-padding); padding-left: var(--settings-padding);
padding-top: var(--settings-padding);
} }
#settings-page-content { #settings-page-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--settings-padding);
max-width: 600px; max-width: 600px;
padding: 0 var(--settings-padding); padding: calc(var(--settings-padding) / 2);
overflow-y: scroll; overflow-y: scroll;
} }
@ -140,6 +138,7 @@
#settings-sidebar { #settings-sidebar {
width: var(--settings-nav-width); width: var(--settings-nav-width);
padding-top: var(--settings-padding);
} }
#settings-sidebar { #settings-sidebar {
@ -189,14 +188,18 @@
padding: 0; padding: 0;
} }
#settings-page-content,
#settings-navigation { #settings-navigation {
padding: var(--padding); padding: var(--padding);
padding-bottom: calc(var(--padding) * 2);
}
#settings-page-content {
padding: var(--padding) 0;
padding-top: 0;
} }
#settings-page-content { #settings-page-content {
max-width: unset; max-width: unset;
gap: calc(var(--padding) * 2);
} }
#settings-header { #settings-header {
@ -210,6 +213,7 @@
#settings-sidebar { #settings-sidebar {
gap: 0px; gap: 0px;
padding: 0;
} }
#settings-page-title { #settings-page-title {