Commit b0017b2c by Ari Rizzitano

clunky fix for passing non-canon props

parent 4b59f66e
......@@ -83,16 +83,7 @@ exports[`Storyshots Dropdown basic usage 1`] = `
<button
aria-expanded={false}
aria-haspopup="true"
buttonType="secondary"
className="btn border-0 dropdown-toggle btn-secondary"
classNames={
Array [
"border-0",
"dropdown-toggle",
]
}
display="Search Engines"
inputRef={[Function]}
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
......
......@@ -12,6 +12,7 @@
"deploy-storybook": "storybook-to-ghpages",
"lint": "eslint --ext .js --ext .jsx .",
"precommit": "yarn run lint",
"snapshot": "jest --updateSnapshot",
"start": "start-storybook -p 6006",
"test": "jest --coverage"
},
......
......@@ -5,11 +5,23 @@ import PropTypes from 'prop-types';
import buttons from 'bootstrap/scss/_buttons.scss';
function Button(props) {
const {
buttonType,
className,
display,
inputRef,
onBlur,
onClick,
onKeyDown,
type,
...other
} = props;
return (
<button
className={classNames([
buttons.btn,
...props.classNames,
...props.className,
], {
[buttons[`btn-${props.buttonType}`]]: props.buttonType !== undefined,
})}
......@@ -18,7 +30,7 @@ function Button(props) {
onKeyDown={props.onKeyDown}
type={props.type}
ref={props.inputRef}
{...props}
{...other}
>
{props.display}
</button>
......@@ -27,7 +39,7 @@ function Button(props) {
Button.propTypes = {
buttonType: PropTypes.string,
classNames: PropTypes.arrayOf(PropTypes.string),
className: PropTypes.arrayOf(PropTypes.string),
display: PropTypes.string.isRequired,
inputRef: PropTypes.func,
onBlur: PropTypes.func,
......@@ -38,7 +50,7 @@ Button.propTypes = {
Button.defaultProps = {
buttonType: undefined,
classNames: [],
className: [],
inputRef: () => {},
onBlur: () => {},
onClick: () => {},
......
......@@ -134,7 +134,7 @@ class Dropdown extends React.Component {
display={this.props.title}
onClick={this.toggle}
onKeyDown={this.handleToggleKeyDown}
classNames={[
className={[
borders['border-0'],
dd['dropdown-toggle'],
]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment