1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00

Prevent warning for rounded buttons (#12357)

This commit is contained in:
David Walsh 2021-10-18 14:52:44 -05:00 committed by GitHub
parent fa52753d00
commit 9fa1e42031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,22 +27,22 @@ const typeHash = {
const Button = ({ const Button = ({
type, type,
submit, submit = false,
large, large,
children, children,
icon, icon,
className, className,
rounded = true,
...buttonProps ...buttonProps
}) => { }) => {
const doRounding = rounded && type !== 'link';
// To support using the Button component to render styled links that are semantic html // To support using the Button component to render styled links that are semantic html
// we swap the html tag we use to render this component and delete any buttonProps that // we swap the html tag we use to render this component and delete any buttonProps that
// we know to be erroneous attributes for a link. We will likely want to extract Link // we know to be erroneous attributes for a link. We will likely want to extract Link
// to its own component in the future. // to its own component in the future.
let Tag = 'button'; let Tag = 'button';
let rounded = true;
if (type === 'link') { if (type === 'link') {
Tag = 'a'; Tag = 'a';
rounded = false;
} else if (submit) { } else if (submit) {
buttonProps.type = 'submit'; buttonProps.type = 'submit';
} }
@ -59,7 +59,7 @@ const Button = ({
<Tag <Tag
className={classnames( className={classnames(
'button', 'button',
rounded && CLASSNAME_ROUNDED, doRounding && CLASSNAME_ROUNDED,
typeHash[type] || CLASSNAME_DEFAULT, typeHash[type] || CLASSNAME_DEFAULT,
large && CLASSNAME_LARGE, large && CLASSNAME_LARGE,
className, className,
@ -79,10 +79,7 @@ Button.propTypes = {
className: PropTypes.string, className: PropTypes.string,
children: PropTypes.node, children: PropTypes.node,
icon: PropTypes.node, icon: PropTypes.node,
}; rounded: PropTypes.bool,
Button.defaultProps = {
submit: false,
}; };
export default Button; export default Button;