import { Swap } from '@ark-ui/solid/swap'
import { MoonIcon, SunIcon } from 'lucide-solid'
import { createSignal } from 'solid-js'
import styles from 'styles/swap.module.css'

export const Rotate = () => {
  const [swapped, setSwapped] = createSignal(false)

  return (
    <button type="button" class={styles.Button} onClick={() => setSwapped((prev) => !prev)}>
      <Swap.Root swap={swapped()}>
        <Swap.Indicator type="on" class={styles.RotateIndicator}>
          <SunIcon />
        </Swap.Indicator>
        <Swap.Indicator type="off" class={styles.RotateIndicator}>
          <MoonIcon />
        </Swap.Indicator>
      </Swap.Root>
    </button>
  )
}
