Skip to content

Commit 36cca53

Browse files
committed
WIP: Create mockup of LoopControls
1 parent 918232f commit 36cca53

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

src/lib/LoopControls.svelte

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<script>
2+
import EditableNumber from './EditableNumber.svelte'
3+
4+
let { loop = $bindable(1), loops = $bindable(1) } = $props()
5+
</script>
6+
7+
<div class="join">
8+
<div class="join-item flex flex-col">
9+
<button
10+
aria-label={loops === 1 ? 'Repeat' : 'Do not repeat'}
11+
class="btn join-item"
12+
onclick={() => (loops = loops === 1 ? Infinity : 1)}
13+
>
14+
<!--
15+
The SVG icons in this file were obtained from https://tabler.io/icons.
16+
17+
MIT License
18+
19+
Copyright (c) 2020-2024 Paweł Kuna
20+
21+
Permission is hereby granted, free of charge, to any person obtaining a copy of
22+
this software and associated documentation files (the "Software"), to deal in
23+
the Software without restriction, including without limitation the rights to
24+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
25+
the Software, and to permit persons to whom the Software is furnished to do so,
26+
subject to the following conditions:
27+
28+
The above copyright notice and this permission notice shall be included in all
29+
copies or substantial portions of the Software.
30+
31+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
33+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
34+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
35+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
37+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
38+
><path
39+
fill="none"
40+
stroke="currentColor"
41+
stroke-linecap="round"
42+
stroke-linejoin="round"
43+
stroke-width="2"
44+
d={loops === 1
45+
? 'M4 12V9a3 3 0 0 1 3-3h13m-3-3l3 3l-3 3m3 3v3a3 3 0 0 1-3 3H4m3 3l-3-3l3-3'
46+
: 'M4 12V9a3 3 0 0 1 2.08-2.856M10 6h10m-3-3l3 3l-3 3m3 3v3a3 3 0 0 1-.133.886m-1.99 1.984A3 3 0 0 1 17 18H4m3 3l-3-3l3-3M3 3l18 18'}
47+
/></svg
48+
>
49+
</button>
50+
</div>
51+
<div class="join-item bg-base-100 ps-4 pe-2 muted relative top-[1px] flex place-items-center">
52+
Loop
53+
</div>
54+
<EditableNumber class="bg-base-100" bind:value={loop}></EditableNumber>
55+
<div class="join-item bg-base-100 px-2 muted relative top-[1px] flex place-items-center">/</div>
56+
<EditableNumber
57+
class="bg-base-100 pe-4"
58+
bind:value={() => loops, v => (loops = v === 0 ? Infinity : v)}
59+
></EditableNumber>
60+
<button class="btn join-item h-auto">Start</button>
61+
<button aria-label="Reset" class="btn join-item" disabled={loop === 1} onclick={() => (loop = 1)}>
62+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
63+
><g
64+
class="icon-tabler"
65+
fill="none"
66+
stroke="currentColor"
67+
stroke-width="2"
68+
stroke-linecap="round"
69+
stroke-linejoin="round"
70+
><path
71+
d="M20 18V6a2 2 0 0 0-2.75-1.84L9 10.26a2 2 0 0 0 0 3.5l8.25 6.1A2 2 0 0 0 20 18.11"
72+
/><path d="M4 20V4" /></g
73+
></svg
74+
>
75+
</button>
76+
</div>

0 commit comments

Comments
 (0)