web/settings: move switcher description to correct component

This commit is contained in:
wukko 2024-07-10 19:35:23 +06:00
parent d8420116dc
commit c013134b70
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
7 changed files with 42 additions and 41 deletions

View file

@ -49,7 +49,7 @@
.toggle-parent { .toggle-parent {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 8px;
overflow: hidden; overflow: hidden;
} }

View file

@ -1,12 +1,24 @@
<script lang="ts"> <script lang="ts">
export let big: boolean = false; export let big: boolean = false;
export let description: string = "";
</script> </script>
<div id="switcher-container" class="switcher" class:big={big} role="listbox"> <div class="switcher-parent">
<slot></slot> <div class="switcher" class:big={big} role="listbox">
<slot></slot>
</div>
{#if description}
<div class="settings-content-description subtext">{description}</div>
{/if}
</div> </div>
<style> <style>
.switcher-parent {
display: flex;
flex-direction: column;
gap: 8px;
}
.switcher { .switcher {
display: flex; display: flex;
width: auto; width: auto;

View file

@ -3,7 +3,6 @@
export let sectionId: string; export let sectionId: string;
export let title: string; export let title: string;
export let description: string = "";
let animate = false; let animate = false;
@ -21,17 +20,13 @@
> >
<h3 class="settings-content-title">{title}</h3> <h3 class="settings-content-title">{title}</h3>
<slot></slot> <slot></slot>
{#if description.length > 0}
<div class="settings-content-description subtext">{description}</div>
{/if}
</section> </section>
<style> <style>
.settings-content { .settings-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: var(--padding);
padding: calc(var(--settings-padding) / 2); padding: calc(var(--settings-padding) / 2);
border-radius: 18px; border-radius: 18px;
} }

View file

@ -12,12 +12,8 @@
import LanguageAutoToggle from "$components/settings/LanguageAutoToggle.svelte"; import LanguageAutoToggle from "$components/settings/LanguageAutoToggle.svelte";
</script> </script>
<SettingsCategory <SettingsCategory sectionId="theme" title={$t("settings.theme")}>
sectionId="theme" <Switcher big={true} description={$t("settings.theme.description")}>
title={$t("settings.theme")}
description={$t("settings.theme.description")}
>
<Switcher big={true}>
{#each themeOptions as value} {#each themeOptions as value}
<SettingsButton <SettingsButton
settingContext="appearance" settingContext="appearance"

View file

@ -9,12 +9,8 @@
import SettingsToggle from "$components/buttons/SettingsToggle.svelte"; import SettingsToggle from "$components/buttons/SettingsToggle.svelte";
</script> </script>
<SettingsCategory <SettingsCategory sectionId="audio-format" title={$t("settings.audio.format")}>
sectionId="audio-format" <Switcher big={true} description={$t("settings.audio.format.description")}>
title={$t("settings.audio.format")}
description={$t("settings.audio.format.description")}
>
<Switcher big={true}>
{#each audioFormatOptions as value} {#each audioFormatOptions as value}
<SettingsButton <SettingsButton
settingContext="save" settingContext="save"

View file

@ -9,12 +9,11 @@
import SettingsToggle from "$components/buttons/SettingsToggle.svelte"; import SettingsToggle from "$components/buttons/SettingsToggle.svelte";
</script> </script>
<SettingsCategory <SettingsCategory sectionId="filename" title={$t("settings.metadata.filename")}>
sectionId="filename" <Switcher
title={$t("settings.metadata.filename")} big={true}
description={$t("settings.metadata.filename.description")} description={$t("settings.metadata.filename.description")}
> >
<Switcher big={true}>
{#each filenameStyleOptions as value} {#each filenameStyleOptions as value}
<SettingsButton <SettingsButton
settingContext="save" settingContext="save"

View file

@ -13,36 +13,41 @@
<SettingsCategory <SettingsCategory
sectionId="video-quality" sectionId="video-quality"
title={$t("settings.video.quality")} title={$t("settings.video.quality")}
description={$t("settings.video.quality.description")}
> >
<Switcher big={true}> <Switcher big={true} description={$t("settings.video.quality.description")}>
{#each videoQualityOptions as value} {#each videoQualityOptions as value}
<SettingsButton settingContext="save" settingId="videoQuality" settingValue={value}> <SettingsButton
settingContext="save"
settingId="videoQuality"
settingValue={value}
>
{$t(`settings.video.quality.${value}`)} {$t(`settings.video.quality.${value}`)}
</SettingsButton> </SettingsButton>
{/each} {/each}
</Switcher> </Switcher>
</SettingsCategory> </SettingsCategory>
<SettingsCategory <SettingsCategory
sectionId="youtube-codec" sectionId="youtube-codec"
title={$t("settings.video.youtube.codec")} title={$t("settings.video.youtube.codec")}
description={$t("settings.video.youtube.codec.description")}
> >
<Switcher big={true}> <Switcher
big={true}
description={$t("settings.video.youtube.codec.description")}
>
{#each youtubeVideoCodecOptions as value} {#each youtubeVideoCodecOptions as value}
<SettingsButton settingContext="save" settingId="youtubeVideoCodec" settingValue={value}> <SettingsButton
settingContext="save"
settingId="youtubeVideoCodec"
settingValue={value}
>
{$t(`settings.video.youtube.codec.${value}`)} {$t(`settings.video.youtube.codec.${value}`)}
</SettingsButton> </SettingsButton>
{/each} {/each}
</Switcher> </Switcher>
</SettingsCategory> </SettingsCategory>
<SettingsCategory <SettingsCategory sectionId="twitter" title={$t("settings.video.twitter.gif")}>
sectionId="twitter"
title={$t("settings.video.twitter.gif")}>
<SettingsToggle <SettingsToggle
settingContext="save" settingContext="save"
settingId="twitterGif" settingId="twitterGif"
@ -51,9 +56,7 @@
/> />
</SettingsCategory> </SettingsCategory>
<SettingsCategory <SettingsCategory sectionId="tiktok" title={$t("settings.video.tiktok.h265")}>
sectionId="tiktok"
title={$t("settings.video.tiktok.h265")}>
<SettingsToggle <SettingsToggle
settingContext="save" settingContext="save"
settingId="tiktokH265" settingId="tiktokH265"