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
private
devdocker
.env*

View File

@ -57,3 +57,18 @@ a[target='_blank']::after {
margin-left: 2px;
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">
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 Icon from './icons/Icon.svelte';
const toggleMode = () => setThemeMode($themeMode === 'dark' ? 'light' : 'dark');
$: nextMode = ($themeMode === 'dark' ? 'light' : 'dark') as ThemeModeType;
$: iconName = $themeMode === 'light' ? 'DarkMode' : 'LightMode';
const toggleMode = () => setThemeMode(nextMode);
</script>
<Button variant="link" on:click={toggleMode}>
<Icon icon={iconName} />
<span class="visually-hidden">{$t(`common.theme.${nextMode}`)}</span>
</Button>

View File

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

View File

@ -17,5 +17,9 @@
"available": "Available",
"current": "Current",
"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);
});
export const useThemeMode = () => {
export const useThemeMode = () =>
onMount(() =>
themeMode.subscribe((value) => document.documentElement.setAttribute('theme-base', value))
);
};
export const setThemeMode = (mode: ThemeModeType) => {
if (!browser) return;

View File

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