File size: 861 Bytes
e71d24a
 
 
 
 
 
 
 
 
 
 
 
 
a382c22
e71d24a
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<script lang="ts">
	import type { OptionRadio } from "$lib/type";
  import Icon from "@iconify/svelte";

  export let value: string;
  export let options: Array<OptionRadio> = [];
  export let onChange: (value: string) => void = () => {};

  const handleClick = (value: string) => {
    onChange(value);
  };
</script>

<div class="flex items-center justify-start">
  {#each options as option}
    <button
      class={`transition-all duration-200 rounded-full px-4 py-2.5 flex items-center justify-center gap-2 text-sm ${option.value === value ? "bg-neutral-800/60 text-white" : "text-neutral-400"}`}
      on:click={() => handleClick(option.value)}
    >
      {#if option.icon && option.iconColor}
        <Icon icon={option.icon} class="w-4 h-4 {option.value === value && option.iconColor}" />
      {/if}
      {option.label}
    </button>
  {/each}
</div>