Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
at main 35 lines 893 B view raw
1import type { ReactNode } from "react"; 2import { Tooltip } from "@/components/Shared/UI"; 3 4interface ToggleProps { 5 children: ReactNode; 6 disabled?: boolean; 7 onClick?: VoidFunction; 8 pressed: boolean; 9 tooltip?: string; 10} 11 12const Toggle = ({ 13 children, 14 disabled = false, 15 onClick, 16 pressed, 17 tooltip 18}: ToggleProps) => { 19 return ( 20 <Tooltip content={tooltip} placement="top"> 21 <button 22 className="flex items-center justify-center rounded-lg bg-transparent p-2 text-black hover:bg-gray-100 data-[state=on]:bg-gray-200 dark:text-white dark:data-[state=on]:bg-gray-700 dark:hover:bg-gray-800" 23 data-state={pressed ? "on" : "off"} 24 disabled={disabled} 25 onClick={() => onClick?.()} 26 onMouseDown={(event) => event.preventDefault()} 27 type="button" 28 > 29 {children} 30 </button> 31 </Tooltip> 32 ); 33}; 34 35export default Toggle;