2022-03-23 09:28:26 +00:00
|
|
|
import cn from "classnames";
|
2022-02-18 08:20:47 +00:00
|
|
|
import PropTypes from "prop-types";
|
2022-03-01 15:48:37 +00:00
|
|
|
import styled from "styled-components";
|
2022-02-17 11:53:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Primary UI component for user interaction
|
|
|
|
*/
|
2022-03-17 12:15:55 +00:00
|
|
|
export const Button = styled.button.attrs(({ disabled, $primary }) => ({
|
2022-03-01 15:48:37 +00:00
|
|
|
type: "button",
|
2022-03-23 09:28:26 +00:00
|
|
|
className: cn("px-6 py-2.5 rounded-full font-sans uppercase text-xs tracking-wide transition-[opacity_filter]", {
|
|
|
|
"bg-primary text-palette-600": $primary,
|
|
|
|
"bg-white border-2 border-black text-palette-600": !$primary,
|
|
|
|
"cursor-not-allowed opacity-60": disabled,
|
|
|
|
"hover:brightness-90": !disabled,
|
|
|
|
}),
|
2022-03-01 15:48:37 +00:00
|
|
|
}))``;
|
2022-02-17 11:53:32 +00:00
|
|
|
Button.propTypes = {
|
|
|
|
/**
|
|
|
|
* Is this the principal call to action on the page?
|
|
|
|
*/
|
2022-03-01 15:48:37 +00:00
|
|
|
$primary: PropTypes.bool,
|
2022-03-17 12:15:55 +00:00
|
|
|
/**
|
|
|
|
* Prevent interaction on the button
|
|
|
|
*/
|
|
|
|
disabled: PropTypes.bool,
|
2022-02-18 08:20:47 +00:00
|
|
|
};
|
2022-02-17 11:53:32 +00:00
|
|
|
|
|
|
|
Button.defaultProps = {
|
2022-03-01 15:48:37 +00:00
|
|
|
$primary: false,
|
2022-03-17 12:15:55 +00:00
|
|
|
disabled: false,
|
2022-02-18 08:20:47 +00:00
|
|
|
};
|