otterscan/src/components/ExpanderSwitch.tsx
2021-12-13 15:41:37 -03:00

23 lines
498 B
TypeScript

import React from "react";
import { Switch } from "@headlessui/react";
type ExpanderSwitchProps = {
expanded: boolean;
setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
};
const ExpanderSwitch: React.FC<ExpanderSwitchProps> = ({
expanded,
setExpanded,
}) => (
<Switch
className="text-xs font-code"
checked={expanded}
onChange={setExpanded}
>
{expanded ? <span className="text-gray-400">[-]</span> : <>[...]</>}
</Switch>
);
export default ExpanderSwitch;