Skip to content

Instantly share code, notes, and snippets.

@zaydek
Created February 19, 2020 14:07
Show Gist options
  • Save zaydek/6f17f2969926db8d2f81ab487019a393 to your computer and use it in GitHub Desktop.
Save zaydek/6f17f2969926db8d2f81ab487019a393 to your computer and use it in GitHub Desktop.
const Button = ({ svg: SVG, ...props }) => (
<WithTooltip dir="t" tooltip={props.tooltip}>
{!props.on ? (
// Off:
<div className="p-2 text-gray-800 hover:bg-md-gray-100 active:bg-md-gray-200 rounded-lg cursor-pointer" onClick={props.onClick}>
<SVG className="p-px w-5 h-5 stroke-500" />
</div>
) : (
// On:
<div className="p-2 text-blue hover:bg-blue-100 rounded-lg cursor-pointer" onClick={props.onClick}>
<SVG className="p-px w-5 h-5 stroke-500" />
</div>
)}
</WithTooltip>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment