mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 21:42:30 -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';
|
||||
|
||||
const LabeledIconButton = props => (
|
||||
const LabeledIconButton = ({
|
||||
className,
|
||||
imgAlt,
|
||||
imgSrc,
|
||||
onClick,
|
||||
title,
|
||||
...props
|
||||
}) => (
|
||||
<Button
|
||||
className={classNames(props.className, styles.modEditField)}
|
||||
disabled={props.disabled}
|
||||
onClick={props.onClick}
|
||||
className={classNames(className, styles.modEditField)}
|
||||
onClick={onClick}
|
||||
{...props}
|
||||
>
|
||||
<img
|
||||
alt={props.imgAlt}
|
||||
alt={imgAlt}
|
||||
className={styles.editFieldIcon}
|
||||
src={props.imgSrc}
|
||||
src={imgSrc}
|
||||
/>
|
||||
<span className={styles.editFieldTitle}>{props.title}</span>
|
||||
<span className={styles.editFieldTitle}>{title}</span>
|
||||
</Button>
|
||||
);
|
||||
|
||||
LabeledIconButton.propTypes = {
|
||||
className: PropTypes.string,
|
||||
disabled: PropTypes.string,
|
||||
imgAlt: PropTypes.string.isRequired,
|
||||
imgSrc: PropTypes.string.isRequired,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
|
|
Loading…
Reference in a new issue