Skip to content

Commit 1944a30

Browse files
committed
Polish CountdownCard html
Try and keep the lines under 100 characters, remove superfluous classes, reorganise code a bit naturally.
1 parent 536a4b4 commit 1944a30

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/lib/CountdownCard.svelte

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,25 @@
3838
}
3939
</script>
4040

41-
<div
42-
class="grid place-items-center join grid-cols-[auto_1fr] grid-rows-[1fr_1fr] bg-base-100 rounded-sm w-full"
43-
>
44-
<button class="btn btn-md h-full join-item" onclick={() => (dir = !dir)}>
45-
<label class="swap swap-rotate {dir ? 'swap-active' : ''}">
41+
<div class="grid w-full [grid-template-areas:'dir_main''beep_main'] grid-cols-[auto_1fr]">
42+
<button class="btn btn-md rounded-tl-md h-full [grid-area:dir]" onclick={() => (dir = !dir)}>
43+
<label class={['swap swap-rotate', { 'swap-active': dir }]}>
4644
<Up class="swap-on" />
4745
<Down class="swap-off" />
4846
</label>
4947
</button>
48+
<button class="btn btn-md rounded-bl-md h-full" onclick={() => (beeping = !beeping)}>
49+
<label class={['swap', { 'swap-active': beeping }]}>
50+
<Beep class="swap-on" />
51+
<NoBeep class="swap-off" />
52+
</label>
53+
</button>
5054
<div
51-
class="p-2 relative row-span-2 rounded-e-sm border-[#8882] border-t-1 border-r-0 w-full shadow-md"
55+
class="relative rounded-e-sm bg-base-100 border-[#8882] border-t-1 border-r-0 w-full shadow-md [grid-area:main] overflow-hidden"
5256
>
53-
<div
54-
class="flex justify-evenly absolute inset-0 pointer-events-none overflow-hidden max-sm:[&>:nth-child(-n+12)]:hidden"
55-
>
57+
<div class="flex justify-evenly absolute inset-0 pointer-events-none">
5658
{#each [...Array(24).keys()].map(() => Math.random() * 2 + 's') as delay}
57-
<div class="w-[1px] bg-[#8882]">
59+
<div class="w-[1px] bg-[#8882] max-sm:[&:nth-child(-n+10)]:hidden">
5860
<div
5961
style:animation-delay={delay}
6062
class={[
@@ -66,16 +68,10 @@
6668
</div>
6769
{/each}
6870
</div>
69-
<div class="flex justify-evenly items-center w-full max-sm:flex-col">
71+
<div class="p-2 flex justify-evenly items-center w-full max-sm:flex-col">
7072
<TimeInput label={dir ? 'Elapsed' : 'Remaining'} bind:value={getCurrent, updateCurrent} />
7173
<div class="divider sm:divider-horizontal text-xs m-0 muted">of</div>
7274
<TimeInput bind:value={() => time[1], updateTotal} />
7375
</div>
7476
</div>
75-
<button class="btn btn-md rounded-bl-sm h-full join-item" onclick={() => (beeping = !beeping)}>
76-
<label class="swap {beeping ? 'swap-active' : ''}">
77-
<Beep class="swap-on" />
78-
<NoBeep class="swap-off" />
79-
</label>
80-
</button>
8177
</div>

0 commit comments

Comments
 (0)