misc: add slider
This commit is contained in:
1 parent
6f23672278
commit
cb9e1a62e4
4 files changed
+44
-2
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
export let value: number
|
||||
export let min: number = 0
|
||||
export let max: number = 100
|
||||
export let step: number = 1
|
||||
</script>
|
||||
|
||||
<input
|
||||
type="range"
|
||||
bind:value
|
||||
{min}
|
||||
{max}
|
||||
{step}
|
||||
on:change
|
||||
on:click
|
||||
on:keydown
|
||||
on:keypress
|
||||
class="w-full appearance-none h-2 cursor-pointer bg-slate-100 dark:bg-zinc-800
|
||||
rounded-full range"
|
||||
/>
|
||||
|
||||
<style lang="postcss">
|
||||
.range::-moz-range-thumb {
|
||||
border-radius: 50%;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
@apply border-4 bg-white dark:bg-zinc-900 border-primary-900 dark:border-primary-100;
|
||||
transition: all 0.25s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
|
||||
.range:hover::-moz-range-thumb {
|
||||
transform: scale(125%);
|
||||
}
|
||||
.range:active::-moz-range-thumb {
|
||||
transform: scale(90%);
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { userSettings } from '$lib/settings'
|
||||
|
||||
export let width = 48
|
||||
|
||||
const monthColors: {
|
||||
@@ -18,7 +20,7 @@
|
||||
12: '--hover-color-1: #228B22; --hover-color-2: #FFFFFF;',
|
||||
}
|
||||
|
||||
const getMonthColor = () => monthColors[new Date().getMonth() + 1]
|
||||
$: monthColor = monthColors[new Date().getMonth() + 1]
|
||||
</script>
|
||||
|
||||
<svg
|
||||
@@ -28,7 +30,7 @@
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="inline"
|
||||
style={getMonthColor()}
|
||||
style={monthColor}
|
||||
>
|
||||
<linearGradient
|
||||
gradientTransform="rotate(315, 0.5, 0.5)"
|
||||
|
||||
@@ -101,6 +101,7 @@ interface Settings {
|
||||
tagRules: {
|
||||
[key: string]: 'hide' | 'blur'
|
||||
}
|
||||
logoColorMonth: number | null
|
||||
}
|
||||
|
||||
export const defaultSettings: Settings = {
|
||||
@@ -181,6 +182,7 @@ export const defaultSettings: Settings = {
|
||||
nsfl: 'blur',
|
||||
nsfw: 'blur',
|
||||
},
|
||||
logoColorMonth: null,
|
||||
}
|
||||
|
||||
export const userSettings = writable(defaultSettings)
|
||||
|
||||
Reference in new issue
Block a user