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">
import { page } from "$app/stores";
export let sectionId: string;
export let title: string;
export let description: string = "";
let animate = false;
$: hash = $page.url.hash.replace("#", "");
$: if (hash === sectionId) {
animate = true;
}
</script>
<section id={sectionId} class="settings-content">
<section
id={sectionId}
class="settings-content"
class:animate
>
<h3 class="settings-content-title">{title}</h3>
<slot></slot>
@ -18,5 +32,32 @@
display: flex;
flex-direction: column;
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>

View file

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