Skip to content

Commit

Permalink
styled FilterButton
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosGDCJ committed May 22, 2023
1 parent 161c9ee commit 4fc9fee
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions src/components/FilterButton.svelte
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
<script lang="ts">
import { RadioGroup, RadioItem } from '@skeletonlabs/skeleton';
import { Filter } from '../types/filter.enum';
export let filter: Filter = Filter.ALL;
</script>

<!-- Filter -->
<div class="filters btn-group stack-exception">
<button
class="btn toggle-btn"
class:btn__primary={filter === Filter.ALL}
aria-pressed={filter === Filter.ALL}
on:click={() => (filter = Filter.ALL)}
<div class="place-self-center">
<RadioGroup
active="variant-filled-primary"
hover="hover:variant-soft-primary"
display="flex"
spacing="space-x-6"
>
<span class="visually-hidden">Show</span>
<span>All</span>
<span class="visually-hidden">tasks</span>
</button>
<button
class="btn toggle-btn"
class:btn__primary={filter === Filter.ACTIVE}
aria-pressed={filter === Filter.ACTIVE}
on:click={() => (filter = Filter.ACTIVE)}
>
<span class="visually-hidden">Show</span>
<span>Active</span>
<span class="visually-hidden">tasks</span>
</button>
<button
class="btn toggle-btn"
class:btn__primary={filter === Filter.COMPLETED}
aria-pressed={filter === Filter.COMPLETED}
on:click={() => (filter = Filter.COMPLETED)}
>
<span class="visually-hidden">Show</span>
<span>Completed</span>
<span class="visually-hidden">tasks</span>
</button>
<RadioItem bind:group={filter} name="all" value={Filter.ALL}>
<span class="visually-hidden">Show</span>
<span>All</span>
<span class="visually-hidden">tasks</span>
</RadioItem>
<RadioItem bind:group={filter} name="completed" value={Filter.COMPLETED}>
<span class="visually-hidden">Show</span>
<span>Completed</span>
<span class="visually-hidden">tasks</span>
</RadioItem>
<RadioItem bind:group={filter} name="active" value={Filter.ACTIVE}>
<span class="visually-hidden">Show</span>
<span>Active</span>
<span class="visually-hidden">tasks</span>
</RadioItem>
</RadioGroup>
</div>

<style>
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
white-space: nowrap;
}
</style>

0 comments on commit 4fc9fee

Please sign in to comment.