Skip to content

Instantly share code, notes, and snippets.

@Mazuh
Created February 28, 2021 20:42
Show Gist options
  • Save Mazuh/add18ca66d2d4cc8e8fd6e498a9f6716 to your computer and use it in GitHub Desktop.
Save Mazuh/add18ca66d2d4cc8e8fd6e498a9f6716 to your computer and use it in GitHub Desktop.
function getBgColor(variant) {
if (variant === "primary") {
return "blue";
}
if (variant === "danger") {
return "red";
}
if (variant === "warning") {
return "yellow";
}
return "none";
}
function Button({ variant = "primary", ...props }) {
return <button style={{ background: getBgColor(variant) }} {...props} />;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment