diff --git a/ui/app/components/ui/button/button.component.js b/ui/app/components/ui/button/button.component.js index d0405aa3d..c82e52c2a 100644 --- a/ui/app/components/ui/button/button.component.js +++ b/ui/app/components/ui/button/button.component.js @@ -25,22 +25,33 @@ const typeHash = { 'first-time': CLASSNAME_FIRST_TIME, } -const Button = ({ type, submit, large, children, icon, rounded, className, ...buttonProps }) => ( - -) +const Button = ({ type, submit, large, children, icon, rounded, className, ...buttonProps }) => { + // 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' + if (type === 'link') { + Tag = 'a' + } else if (submit) { + buttonProps.type = 'submit' + } + return ( + + {icon && {icon}} + { children } + + ) +} Button.propTypes = { type: PropTypes.string,