fix: use labels for swicthes

This commit is contained in:
Xyphyn committed 2023-10-14 11:08:59 -07:00
1 parent 2bf44fbf1b
commit ea594e0061
4 files changed
+75 -70

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
const setSelected = () => (selected = sort) const setSelected = () => (selected = sort)
</script> </script>
<div class="flex flex-row gap-4 flex-wrap"> <div class="flex flex-row gap-4 {$$props.class}">
{#if selected?.startsWith('Top')} {#if selected?.startsWith('Top')}
<div transition:fly={{ x: 4 }}> <div transition:fly={{ x: 4 }}>
<Select <Select
+51 -68
View File
@@ -23,6 +23,7 @@
import { LINKED_INSTANCE_URL } from '$lib/instance.js' import { LINKED_INSTANCE_URL } from '$lib/instance.js'
import { removeItem } from '$lib/util.js' import { removeItem } from '$lib/util.js'
import Section from './Section.svelte' import Section from './Section.svelte'
import ToggleSetting from './ToggleSetting.svelte'
let data = { let data = {
loading: false, loading: false,
@@ -49,7 +50,7 @@
</h1> </h1>
<div class="flex flex-col gap-4" style="scroll-behavior: smooth;"> <div class="flex flex-col gap-4" style="scroll-behavior: smooth;">
<Section title="UI"> <Section title="Photon">
<Setting> <Setting>
<span slot="title">Post style</span> <span slot="title">Post style</span>
<ViewSelect showLabel={false} /> <ViewSelect showLabel={false} />
@@ -65,26 +66,12 @@
{/if} {/if}
</p> </p>
</Setting> </Setting>
<Setting> <Setting optionClass="flex-[2] max-w-full flex-wrap min-w-0">
<span slot="title">Random placeholders</span>
<span slot="description">
Show a random placeholder for forms for comments, posts, etc.
</span>
<Switch bind:checked={$userSettings.randomPlaceholders} />
</Setting>
<Setting>
<span slot="title">Limit Layout Width</span>
<span slot="description">
Improve readability by limiting main content width.
</span>
<Switch bind:checked={$userSettings.newWidth} />
</Setting>
<Setting optionClass="flex-[2]">
<span slot="title">Default sort</span> <span slot="title">Default sort</span>
<span slot="description">The default sort to use for feeds.</span> <span slot="description">The default sort to use for feeds.</span>
<div class="flex flex-wrap flex-row gap-4 w-max max-w-full"> <div class="flex max-[500px]:flex-col flex-wrap gap-4 w-max max-w-full">
<div class="max-w-full"> <div class="max-w-full">
<Select bind:value={$userSettings.defaultSort.feed} class="w-28"> <Select bind:value={$userSettings.defaultSort.feed}>
<span slot="label" class="flex items-center gap-1"> <span slot="label" class="flex items-center gap-1">
<Icon src={GlobeAmericas} size="16" mini /> <Icon src={GlobeAmericas} size="16" mini />
Location Location
@@ -114,14 +101,6 @@
</div> </div>
</div> </div>
</Setting> </Setting>
<Setting>
<span slot="title">Use display name</span>
<span slot="description">
Show a user's display name instead of their account username.
</span>
<Switch bind:checked={$userSettings.displayNames} />
</Setting>
<Setting> <Setting>
<span slot="title">Vote style</span> <span slot="title">Vote style</span>
<MultiSelect <MultiSelect
@@ -130,14 +109,27 @@
bind:selected={$userSettings.separateVotes} bind:selected={$userSettings.separateVotes}
/> />
</Setting> </Setting>
<Setting> <ToggleSetting
<span slot="title">Expand Images</span> bind:checked={$userSettings.displayNames}
<span slot="description"> title="Use display name"
Clicking on a post's image brings you to an expanded view rather than description="Show a user's display name instead of their account username."
sending you to the post page. />
</span> <ToggleSetting
<Switch bind:checked={$userSettings.expandImages} /> bind:checked={$userSettings.newWidth}
</Setting> title="Limit layout width"
description="Improve readability by limiting main content width."
/>
<ToggleSetting
bind:checked={$userSettings.randomPlaceholders}
title="Random placeholders"
description="Show a random placeholder for forms for comments, posts, etc."
/>
<ToggleSetting
bind:checked={$userSettings.randomPlaceholders}
title="Expand Images"
description="Clicking on a post's image brings you to an expanded view rather than
sending you to the post page."
/>
<Setting> <Setting>
<span slot="title">Thumbnail Alignment</span> <span slot="title">Thumbnail Alignment</span>
<span slot="description"> <span slot="description">
@@ -150,36 +142,30 @@
/> />
</Setting> </Setting>
{#if LINKED_INSTANCE_URL} {#if LINKED_INSTANCE_URL}
<Setting> <ToggleSetting
<span slot="title">Remove "Powered by Photon"</span> title={'Remove "Powered by Photon"'}
<span slot="description"> description="Remove the massive 120x16 div in the top left corner."
Remove the massive 120x16 div in the top left corner. bind:checked={$userSettings.hidePhoton}
</span> />
<Switch bind:checked={$userSettings.hidePhoton} />
</Setting>
{/if} {/if}
</Section> </Section>
<Section title="Lemmy"> <Section title="Lemmy">
<Setting> <ToggleSetting
<span slot="title">Mark read posts</span> bind:checked={$userSettings.markPostsAsRead}
<span slot="description">Mark a post as read when you click on it.</span> title="Mark read posts"
<Switch bind:checked={$userSettings.markPostsAsRead} /> description="Mark a post as read when you click on it."
</Setting> />
<Setting> <ToggleSetting
<span slot="title">Fade read posts</span> bind:checked={$userSettings.markReadPosts}
<span slot="description"> title="Fade read posts"
Fade the title of posts you've already read. description="Fade the title of posts you've already read."
</span> />
<Switch bind:checked={$userSettings.markReadPosts} /> <ToggleSetting
</Setting> bind:checked={$userSettings.nsfwBlur}
<Setting> title="NSFW blur"
<span slot="title">NSFW blur</span> description="Blur images and remove post bodies of NSFW content."
<span slot="description"> />
Blur images and remove post bodies of NSFW content.
</span>
<Switch bind:checked={$userSettings.nsfwBlur} />
</Setting>
<Setting> <Setting>
<span slot="title">Hide Posts</span> <span slot="title">Hide Posts</span>
<span slot="description"> <span slot="description">
@@ -315,13 +301,10 @@
</Section> </Section>
<Section title="Other"> <Section title="Other">
<Setting> <ToggleSetting
<span slot="title">Debug Info</span> bind:checked={$userSettings.debugInfo}
<span slot="description"> title="Debug info"
Show an option to show debug information. (in posts and such) description="Display debug information"
</span> />
<Switch bind:checked={$userSettings.debugInfo} />
</Setting>
</Section> </Section>
</div> </div>
+1 -1
View File
@@ -1,4 +1,4 @@
<div class="flex flex-row items-center w-full justify-between gap-4"> <div class="flex flex-row items-center w-full justify-between gap-4 max-w-full">
<div class="flex flex-col gap-0.5 flex-1 {$$props.class}"> <div class="flex flex-col gap-0.5 flex-1 {$$props.class}">
<h1 class="font-medium text-base"><slot name="title" /></h1> <h1 class="font-medium text-base"><slot name="title" /></h1>
{#if $$slots.description} {#if $$slots.description}
+22
View File
@@ -0,0 +1,22 @@
<script lang="ts">
import { Switch } from 'mono-svelte'
export let title: string
export let description: string | undefined = undefined
export let checked: boolean = false
</script>
<div class="flex flex-row items-center w-full justify-between gap-4 max-w-full">
<Switch
bind:checked
class="flex-row-reverse items-center w-full"
labelClass="flex-1 mr-auto"
>
<h1 class="font-medium text-base">{title}</h1>
{#if description}
<p class="text-slate-800 dark:text-zinc-200 text-sm">
{description}
</p>
{/if}
</Switch>
</div>