Button icon variant

Summary: Allow setting the icon variant for icons on buttons

Reviewed By: jknoxville

Differential Revision: D10101603

fbshipit-source-id: 344afda2296479ffb8449a7ad8172b35f0dc95e4
This commit is contained in:
Daniel Büchele
2018-09-28 08:55:20 -07:00
committed by Facebook Github Bot
parent a455520ecb
commit 9caddc2b8b

View File

@@ -203,6 +203,7 @@ type Props = {
* Whether the button should render depressed into its socket * Whether the button should render depressed into its socket
*/ */
depressed?: boolean, depressed?: boolean,
iconVariant?: 'filled' | 'outline',
}; };
type State = { type State = {
@@ -300,6 +301,7 @@ class Button extends React.Component<
selected, selected,
iconSize, iconSize,
windowIsFocused, windowIsFocused,
iconVariant,
...props ...props
} = this.props; } = this.props;
const {active} = this.state; const {active} = this.state;
@@ -324,10 +326,9 @@ class Button extends React.Component<
iconComponent = ( iconComponent = (
<Icon <Icon
name={icon} name={icon}
size={ size={iconSize || this.props.compact === true ? 12 : 16}
iconSize != null ? iconSize : this.props.compact === true ? 12 : 16
}
color={color} color={color}
variant={iconVariant || 'filled'}
hasText={Boolean(children)} hasText={Boolean(children)}
/> />
); );