import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
import { useEffect, useState } from "react";
import { classNames } from "@calcom/lib";
export const ToggleGroupItem = () =>
hi
;
interface ToggleGroupProps extends Omit {
options: { value: string; label: string; disabled?: boolean }[];
isFullWidth?: boolean;
}
export const ToggleGroup = ({ options, onValueChange, isFullWidth, ...props }: ToggleGroupProps) => {
const [value, setValue] = useState(props.defaultValue);
const [activeToggleElement, setActiveToggleElement] = useState(null);
useEffect(() => {
if (value && onValueChange) onValueChange(value);
}, [value, onValueChange]);
return (
<>
{/* Active toggle. It's a separate element so we can animate it nicely. */}
{options.map((option) => (
{
if (node && value === option.value) {
setActiveToggleElement(node);
}
return node;
}}>
{option.label}
))}
>
);
};