Created
February 28, 2021 20:42
-
-
Save Mazuh/add18ca66d2d4cc8e8fd6e498a9f6716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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