summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/dashboard/components/button/index.jsx')
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/dashboard/components/button/index.jsx52
1 files changed, 52 insertions, 0 deletions
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/dashboard/components/button/index.jsx b/plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/dashboard/components/button/index.jsx
new file mode 100644
index 00000000..d945554f
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/dashboard/components/button/index.jsx
@@ -0,0 +1,52 @@
+/**
+ * External dependencies
+ */
+import PropTypes from 'prop-types';
+import React from 'react';
+import classNames from 'classnames';
+import { noop } from 'lodash';
+
+/**
+ * Internal dependencies
+ */
+import './style.scss';
+
+export default class Button extends React.Component {
+ static displayName = 'Button';
+
+ static propTypes = {
+ disabled: PropTypes.bool,
+ compact: PropTypes.bool,
+ primary: PropTypes.bool,
+ scary: PropTypes.bool,
+ type: PropTypes.string,
+ href: PropTypes.string,
+ onClick: PropTypes.func,
+ borderless: PropTypes.bool,
+ className: PropTypes.string,
+ };
+
+ static defaultProps = {
+ disabled: false,
+ type: 'button',
+ onClick: noop,
+ borderless: false,
+ };
+
+ render() {
+ const element = this.props.href ? 'a' : 'button';
+ const { primary, compact, scary, borderless, className, ...props } = this.props;
+
+ const buttonClasses = classNames( {
+ 'dops-button': true,
+ 'is-compact': compact,
+ 'is-primary': primary,
+ 'is-scary': scary,
+ 'is-borderless': borderless,
+ } );
+
+ props.className = classNames( className, buttonClasses );
+
+ return React.createElement( element, props, this.props.children );
+ }
+}