1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02: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 = ({
type,
submit,
submit = false,
large,
children,
icon,
className,
rounded = true,
...buttonProps
}) => {
const doRounding = rounded && type !== 'link';
// 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 know to be erroneous attributes for a link. We will likely want to extract Link
// to its own component in the future.
let Tag = 'button';
let rounded = true;
if (type === 'link') {
Tag = 'a';
rounded = false;
} else if (submit) {
buttonProps.type = 'submit';
}
@ -59,7 +59,7 @@ const Button = ({
<Tag
className={classnames(
'button',
rounded && CLASSNAME_ROUNDED,
doRounding && CLASSNAME_ROUNDED,
typeHash[type] || CLASSNAME_DEFAULT,
large && CLASSNAME_LARGE,
className,
@ -79,10 +79,7 @@ Button.propTypes = {
className: PropTypes.string,
children: PropTypes.node,
icon: PropTypes.node,
};
Button.defaultProps = {
submit: false,
rounded: PropTypes.bool,
};
export default Button;