mirror of https://github.com/immich-app/immich.git
feat(web,a11y): replace IconButton with CircleIconButton (#9153)
* feat(web,a11y): replace IconButton with CircleIconButton * wip: cleanup * wip: bring back viewbox * fix: add label to search barpull/9082/head^2
parent
0c9bf2835d
commit
72ce81f0c2
@ -1,14 +0,0 @@
|
|||||||
<script lang="ts" context="module">
|
|
||||||
export type Color = 'transparent-primary' | 'transparent-gray' | 'overlay-primary';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Button from './button.svelte';
|
|
||||||
|
|
||||||
export let color: Color = 'transparent-primary';
|
|
||||||
export let title: string | undefined = undefined;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Button size="icon" {color} {title} shadow={false} rounded="full" on:click>
|
|
||||||
<slot />
|
|
||||||
</Button>
|
|
||||||
@ -1,17 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { moonPath, moonViewBox, sunPath, sunViewBox } from '$lib/assets/svg-paths';
|
import { moonPath, moonViewBox, sunPath, sunViewBox } from '$lib/assets/svg-paths';
|
||||||
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import { Theme } from '$lib/constants';
|
import { Theme } from '$lib/constants';
|
||||||
import { colorTheme, handleToggleTheme } from '$lib/stores/preferences.store';
|
import { colorTheme, handleToggleTheme } from '$lib/stores/preferences.store';
|
||||||
import IconButton from '../elements/buttons/icon-button.svelte';
|
|
||||||
import Icon from '../elements/icon.svelte';
|
$: icon = $colorTheme.value === Theme.LIGHT ? moonPath : sunPath;
|
||||||
|
$: viewBox = $colorTheme.value === Theme.LIGHT ? moonViewBox : sunViewBox;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !$colorTheme.system}
|
{#if !$colorTheme.system}
|
||||||
<IconButton on:click={handleToggleTheme} title="Toggle theme">
|
<CircleIconButton title="Toggle theme" {icon} {viewBox} on:click={handleToggleTheme} />
|
||||||
{#if $colorTheme.value === Theme.LIGHT}
|
|
||||||
<Icon path={moonPath} viewBox={sunViewBox} class="h-6 w-6" />
|
|
||||||
{:else}
|
|
||||||
<Icon path={sunPath} viewBox={moonViewBox} class="h-6 w-6" />
|
|
||||||
{/if}
|
|
||||||
</IconButton>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Loading…
Reference in New Issue