pass props to button from labeled button

so that we don’t have to check for things like `disabled` twice.
This commit is contained in:
Matthew Taylor 2017-10-26 11:02:01 -04:00
parent 7b783a5c46
commit 9ef967aa24

View file

@ -10,24 +10,30 @@ import Button from '../button/button.jsx';
import styles from './labeled-icon-button.css'; import styles from './labeled-icon-button.css';
const LabeledIconButton = props => ( const LabeledIconButton = ({
className,
imgAlt,
imgSrc,
onClick,
title,
...props
}) => (
<Button <Button
className={classNames(props.className, styles.modEditField)} className={classNames(className, styles.modEditField)}
disabled={props.disabled} onClick={onClick}
onClick={props.onClick} {...props}
> >
<img <img
alt={props.imgAlt} alt={imgAlt}
className={styles.editFieldIcon} className={styles.editFieldIcon}
src={props.imgSrc} src={imgSrc}
/> />
<span className={styles.editFieldTitle}>{props.title}</span> <span className={styles.editFieldTitle}>{title}</span>
</Button> </Button>
); );
LabeledIconButton.propTypes = { LabeledIconButton.propTypes = {
className: PropTypes.string, className: PropTypes.string,
disabled: PropTypes.string,
imgAlt: PropTypes.string.isRequired, imgAlt: PropTypes.string.isRequired,
imgSrc: PropTypes.string.isRequired, imgSrc: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,