Skip to content

Commit

Permalink
rewrite checkbox; fix github link
Browse files Browse the repository at this point in the history
  • Loading branch information
0ql committed Jul 24, 2023
1 parent 636e6dd commit bed6d5b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
Settings
<a
class="text-xs text-current"
href="https://github.com/0ql/Coffeetyper"
href="https://github.com/0ql/Coffeetyper-Svelte"
target="_blank"
>
Github
Expand Down
41 changes: 29 additions & 12 deletions src/components/ui/checkbox.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
<script lang="ts">
export let checked: boolean;
const onClick = (): void => {
checked = !checked;
};
</script>

<div
class="bg-[var(--sub-color)] w-[1rem] h-[1rem] rounded-full {$$props.class} flex justify-center items-center cursor-pointer"
on:click={onClick}
>
{#if checked === true}
<div class="w-[60%] h-[60%] bg-[var(--text-color)] rounded-full" />
{/if}
</div>
<input
type="checkbox"
class="{$$props.class}"
bind:checked
/>

<style>
input[type="checkbox"] {
appearance: none;
position: relative;
width: 1rem;
height: 1rem;
background: var(--sub-color);
border-radius: 10000px;
margin: 0;
padding: 0;
cursor: pointer;
}
input[type="checkbox"]:checked::before {
content: "";
background: var(--text-color);
position: absolute;
top: 0.2rem;
left: 0.2rem;
width: 0.6rem;
height: 0.6rem;
border-radius: 10000px;
}
</style>

0 comments on commit bed6d5b

Please sign in to comment.