Commit b0017b2c by Ari Rizzitano

clunky fix for passing non-canon props

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