import React from "react"; import { HelpText } from "@/components/typography/HelpText"; import { Label } from "@/components/typography/Label"; import { ToggleSwitch } from "@/components/switches/ToggleSwitch"; import { cn } from "@/lib/cn"; interface Props { value: boolean; onChange: (value: boolean) => void; helpText?: React.ReactNode; label?: React.ReactNode; children?: React.ReactNode; disabled?: boolean; loading?: boolean; dataCy?: string; className?: string; labelClassName?: string; textWrapperClassName?: string; } export default function FancyToggleSwitch({ value, onChange, helpText, label, children, disabled = false, loading = false, dataCy, className, labelClassName, textWrapperClassName = "max-w-lg", }: Readonly) { const switchId = React.useId(); const descriptionId = React.useId(); if (loading) { const shimmer = "text-transparent select-none rounded bg-nb-gray-920 box-decoration-clone animate-pulse"; return (
{helpText}
); } return (
{helpText}
{children && value ?
{children}
: null}
); }