aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/button/button.component.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/button/button.component.js')
-rw-r--r--ui/app/components/button/button.component.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/app/components/button/button.component.js b/ui/app/components/button/button.component.js
new file mode 100644
index 000000000..fe3bf363c
--- /dev/null
+++ b/ui/app/components/button/button.component.js
@@ -0,0 +1,44 @@
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import classnames from 'classnames'
+
+const SECONDARY = 'secondary'
+const CLASSNAME_PRIMARY = 'btn-primary'
+const CLASSNAME_PRIMARY_LARGE = 'btn-primary--lg'
+const CLASSNAME_SECONDARY = 'btn-secondary'
+const CLASSNAME_SECONDARY_LARGE = 'btn-secondary--lg'
+
+const getClassName = (type, large = false) => {
+ let output = type === SECONDARY ? CLASSNAME_SECONDARY : CLASSNAME_PRIMARY
+
+ if (large) {
+ output += ` ${type === SECONDARY ? CLASSNAME_SECONDARY_LARGE : CLASSNAME_PRIMARY_LARGE}`
+ }
+
+ return output
+}
+
+class Button extends Component {
+ render () {
+ const { type, large, className, ...buttonProps } = this.props
+
+ return (
+ <button
+ className={classnames(getClassName(type, large), className)}
+ { ...buttonProps }
+ >
+ { this.props.children }
+ </button>
+ )
+ }
+}
+
+Button.propTypes = {
+ type: PropTypes.string,
+ large: PropTypes.bool,
+ className: PropTypes.string,
+ children: PropTypes.string,
+}
+
+export default Button
+