otterscan/src/components/ExpanderSwitch.tsx

23 lines
498 B
TypeScript
Raw Normal View History

2021-12-13 18:41:37 +00:00
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;