mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 05:52:42 -05:00
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:
parent
7b783a5c46
commit
9ef967aa24
1 changed files with 14 additions and 8 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue