feat: add theme deletion
This commit is contained in:
1 parent
1f08f04a0c
commit
926af69ec5
3 files changed
+45
-38
No files matched your search
@@ -27,18 +27,18 @@ export function getDefaultColors(): ThemeColors {
|
|||||||
500: '107 114 128',
|
500: '107 114 128',
|
||||||
600: '75 85 99',
|
600: '75 85 99',
|
||||||
700: '55 65 81',
|
700: '55 65 81',
|
||||||
800: '31 41 55',
|
800: '22 31 45',
|
||||||
900: '17 24 39',
|
900: '17 24 39',
|
||||||
925: '8 12 25',
|
925: '8 12 25',
|
||||||
950: '3 7 18',
|
950: '3 7 18',
|
||||||
},
|
},
|
||||||
primary: {
|
primary: {
|
||||||
100: 'var(--c-p-100,241 245 249)',
|
100: '241 245 249',
|
||||||
900: 'var(--c-p-900,15 23 42)',
|
900: '15 23 42',
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
black: `var(--c-o-black,0 0 0)`,
|
black: `0 0 0`,
|
||||||
white: `var(--c-o-white,255 255 255)`,
|
white: `255 255 255`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,10 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4 h-full">
|
<div class="flex flex-col gap-4 h-full">
|
||||||
<Header>Theme</Header>
|
<Header>Theme</Header>
|
||||||
<div class="grid grid-cols-4 items-center gap-4 overflow-auto max-h-72">
|
<div
|
||||||
|
class="grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4
|
||||||
|
gap-4 overflow-auto max-h-72"
|
||||||
|
>
|
||||||
{#each $themeData.themes as theme}
|
{#each $themeData.themes as theme}
|
||||||
<ThemePreset {theme} />
|
<ThemePreset {theme} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { calculateVars, themeData, type Theme } from '$lib/ui/colors'
|
import { calculateVars, themeData, type Theme } from '$lib/ui/colors'
|
||||||
import { Button, Material, modal } from 'mono-svelte'
|
import { action, Button, Material, modal } from 'mono-svelte'
|
||||||
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons'
|
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons'
|
||||||
|
|
||||||
export let theme: Theme
|
export let theme: Theme
|
||||||
@@ -41,39 +41,43 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<div class="px-4 py-2 flex items-center gap-1 justify-between">
|
<div class="px-4 py-2 flex items-center gap-1 justify-between">
|
||||||
<span class="font-medium text-lg font-display">{theme.name}</span>
|
<span class="font-medium text-lg font-display">{theme.name}</span>
|
||||||
<Button
|
{#if theme.id > 0}
|
||||||
color="ghost"
|
<Button
|
||||||
size="square-md"
|
color="ghost"
|
||||||
on:click={() => {
|
size="square-md"
|
||||||
modal({
|
on:click={() => {
|
||||||
actions: [
|
modal({
|
||||||
{
|
actions: [
|
||||||
close: true,
|
action({
|
||||||
content: $t('common.cancel'),
|
close: true,
|
||||||
type: 'secondary',
|
type: 'secondary',
|
||||||
action: () => {},
|
content: $t('common.cancel'),
|
||||||
},
|
}),
|
||||||
{
|
{
|
||||||
close: true,
|
close: true,
|
||||||
content: $t('routes.theme.preset.delete.confirm'),
|
content: $t('routes.theme.preset.delete.confirm'),
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
action: () => {
|
action: () => {
|
||||||
const index = $themeData.themes
|
const index = $themeData.themes
|
||||||
.map((t) => t.id)
|
.map((t) => t.id)
|
||||||
.indexOf(theme.id)
|
.indexOf(theme.id)
|
||||||
|
|
||||||
$themeData.themes = $themeData.themes.toSpliced(index, 1)
|
$themeData.themes = $themeData.themes.toSpliced(index, 1)
|
||||||
|
if (theme.id == $themeData.currentTheme) {
|
||||||
|
$themeData.currentTheme = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
type: 'error',
|
||||||
type: 'error',
|
body: '',
|
||||||
body: '',
|
title: $t('routes.theme.preset.delete.title'),
|
||||||
title: $t('routes.theme.preset.delete.title'),
|
})
|
||||||
})
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Icon src={Trash} size="16" mini slot="prefix" />
|
||||||
<Icon src={Trash} size="16" mini slot="prefix" />
|
</Button>
|
||||||
</Button>
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</Material>
|
</Material>
|
||||||
</button>
|
</button>
|
||||||
Reference in new issue
Block a user