Skip to content

Commit

Permalink
replace range by buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
willpinha committed Jan 19, 2024
1 parent afd9511 commit b79e5d2
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/components/Navbar.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
<script lang="ts">
import { chroma, copied } from "../stores";
const max = 0.37;
const increment = 0.01;
$: {
if ($chroma < 0) {
$chroma += increment;
}
if ($chroma > max) {
$chroma -= increment;
}
$chroma = parseFloat($chroma.toFixed(2));
}
</script>

<div class="flex justify-center w-full p-4 fixed top-0">
<nav class="navbar flex-col bg-base-200 max-w-md rounded-box shadow min-h-0">
<div class="flex justify-between w-full">
<div class="flex gap-2">
<input class="range range-sm range-primary" type="range" min="0" max="0.37" step="0.01" bind:value={$chroma} />
<div class="flex items-center gap-2">
<div class="join">
<button class="join-item btn btn-primary btn-sm" on:click={() => $chroma-=increment }>
<i class="fa-solid fa-minus"></i>
</button>

<button class="join-item btn btn-primary btn-sm" on:click={() => $chroma+=increment }>
<i class="fa-solid fa-plus"></i>
</button>
</div>

<span class="text-sm">{$chroma}C</span>
</div>
Expand Down

0 comments on commit b79e5d2

Please sign in to comment.