caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

56 lines
1.7 KiB
TypeScript

import { Switch } from '@headlessui/react'
import clsx from 'clsx'
export default function IconToggle(props: {
on: boolean
setOn: (on: boolean) => void
onIcon: React.ComponentType<{ className?: string }>
offIcon: React.ComponentType<{ className?: string }>
className?: string
}) {
const { on, setOn, className } = props
return (
<Switch
checked={on}
onChange={setOn}
className={clsx(
on ? 'bg-primary-600' : 'bg-ink-200',
'relative inline-flex h-[1.45rem] w-10 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out',
className
)}
>
<span className="sr-only">Use setting</span>
<span
className={clsx(
on ? 'translate-x-4' : 'translate-x-0',
'bg-canvas-0 pointer-events-none relative inline-block h-[1.2rem] w-5 transform rounded-full shadow ring-0 transition duration-200 ease-in-out'
)}
>
<span
className={clsx(
on
? 'opacity-0 duration-100 ease-out'
: 'opacity-100 duration-200 ease-in',
'absolute inset-0 flex h-full w-full items-center justify-center transition-opacity'
)}
aria-hidden="true"
>
{<props.offIcon className={'text-ink-600 h-4'} />}
</span>
<span
className={clsx(
on
? 'opacity-100 duration-200 ease-in'
: 'opacity-0 duration-100 ease-out',
'absolute inset-0 flex h-full w-full items-center justify-center transition-opacity'
)}
aria-hidden="true"
>
{<props.onIcon className={'text-primary-700 h-[1.7rem]'} />}
</span>
</span>
</Switch>
)
}