Small things

This commit is contained in:
Evert Prants 2024-06-07 20:49:31 +03:00
parent 837eeef0ed
commit 88c4dedceb
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
7 changed files with 30 additions and 8 deletions

View File

@ -2,3 +2,4 @@ uploads
node_modules node_modules
private private
devdocker devdocker
.env*

View File

@ -57,3 +57,18 @@ a[target='_blank']::after {
margin-left: 2px; margin-left: 2px;
vertical-align: top; vertical-align: top;
} }
.visually-hidden {
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
&:not(caption) {
position: absolute;
}
}

View File

@ -1,12 +1,16 @@
<script lang="ts"> <script lang="ts">
import { setThemeMode, themeMode } from '$lib/theme-mode'; import { t } from '$lib/i18n';
import { setThemeMode, themeMode, type ThemeModeType } from '$lib/theme-mode';
import Button from './Button.svelte'; import Button from './Button.svelte';
import Icon from './icons/Icon.svelte'; import Icon from './icons/Icon.svelte';
const toggleMode = () => setThemeMode($themeMode === 'dark' ? 'light' : 'dark'); $: nextMode = ($themeMode === 'dark' ? 'light' : 'dark') as ThemeModeType;
$: iconName = $themeMode === 'light' ? 'DarkMode' : 'LightMode'; $: iconName = $themeMode === 'light' ? 'DarkMode' : 'LightMode';
const toggleMode = () => setThemeMode(nextMode);
</script> </script>
<Button variant="link" on:click={toggleMode}> <Button variant="link" on:click={toggleMode}>
<Icon icon={iconName} /> <Icon icon={iconName} />
<span class="visually-hidden">{$t(`common.theme.${nextMode}`)}</span>
</Button> </Button>

View File

@ -4,7 +4,7 @@
$: iconComponent = import(`./svg/${icon}.svelte`); $: iconComponent = import(`./svg/${icon}.svelte`);
</script> </script>
<span class="icon"> <span class="icon" aria-hidden="true">
{#await iconComponent then { default: component }} {#await iconComponent then { default: component }}
<svelte:component this={component} /> <svelte:component this={component} />
{/await} {/await}

View File

@ -17,5 +17,9 @@
"available": "Available", "available": "Available",
"current": "Current", "current": "Current",
"remove": "Remove", "remove": "Remove",
"filter": "Filter" "filter": "Filter",
"theme": {
"light": "Light mode",
"dark": "Dark mode"
}
} }

View File

@ -17,11 +17,10 @@ export const themeMode = writable<ThemeModeType>('light', (set) => {
return () => uaTheme?.removeEventListener('change', uaThemeCallback); return () => uaTheme?.removeEventListener('change', uaThemeCallback);
}); });
export const useThemeMode = () => { export const useThemeMode = () =>
onMount(() => onMount(() =>
themeMode.subscribe((value) => document.documentElement.setAttribute('theme-base', value)) themeMode.subscribe((value) => document.documentElement.setAttribute('theme-base', value))
); );
};
export const setThemeMode = (mode: ThemeModeType) => { export const setThemeMode = (mode: ThemeModeType) => {
if (!browser) return; if (!browser) return;

View File

@ -31,8 +31,7 @@
<div class="auth-list"> <div class="auth-list">
{#each data.items as client} {#each data.items as client}
<!-- TODO: client pictures --> <AvatarCard src={`/api/avatar/client/${client.id}`} alt={client.title}>
<AvatarCard src={`${assets}/application.png`} alt={client.title}>
<div class="card-row"> <div class="card-row">
<div class="card-inner"> <div class="card-inner">
<span class="card-display-name">{client.title}</span> <span class="card-display-name">{client.title}</span>