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