mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-19 21:50:52 -05:00
* Add to nav * Allow nav items on front page to take full width * Initial+ * Fix vods page title * Add page title * Common art type * ArtGrid to a different component * User arts page initial * Add art tab to user page * Preview initial * Fix art counting * Fix link and onclick overlapping * Link to user art page to arts they made * Artist role initial * Show description * Make toggle in art page saved in search params * Add white-space pre-wrap to plus comments Not sure why it was removed in the first place? * Commission open / text and edit those * Add simple pagination * New art link display logic * New art initial * Upload art * Hide art from side nav too * Show banner when waiting for approval * Edit art * Fix art sub nav link not showing active * Relocate unvalidated art text * Delete art * Extract ImagePreview component * Eliminate some layout shift * BigImageDialog extract component + prevent layout shift * i18n * Fix unused var * Fix tests
33 lines
622 B
TypeScript
33 lines
622 B
TypeScript
import { Switch } from "@headlessui/react";
|
|
import clsx from "clsx";
|
|
|
|
export function Toggle({
|
|
checked,
|
|
setChecked,
|
|
tiny,
|
|
id,
|
|
name,
|
|
disabled,
|
|
}: {
|
|
checked: boolean;
|
|
setChecked: (checked: boolean) => void;
|
|
tiny?: boolean;
|
|
id?: string;
|
|
name?: string;
|
|
disabled?: boolean;
|
|
}) {
|
|
return (
|
|
<Switch
|
|
checked={checked}
|
|
onChange={setChecked}
|
|
className={clsx("toggle", { checked, tiny })}
|
|
id={id}
|
|
name={name}
|
|
data-testid={id ? `toggle-${id}` : null}
|
|
disabled={disabled}
|
|
>
|
|
<span className={clsx("toggle-dot", { checked, tiny })} />
|
|
</Switch>
|
|
);
|
|
}
|