| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // @flow
-
- import React from 'react';
- import { Icon } from '../../icons';
-
- type Props = {
-
- /**
- * The decorated component (ToolboxButton).
- */
- children: React$Node,
-
- /**
- * Icon of the button.
- */
- icon: Function,
-
- /**
- * Flag used for disabling the small icon.
- */
- iconDisabled: boolean,
-
- /**
- * Click handler for the small icon.
- */
- onIconClick: Function,
-
- /**
- * Additional styles.
- */
- styles?: Object,
- }
-
- /**
- * Displayes the `ToolboxButtonWithIcon` component.
- *
- * @returns {ReactElement}
- */
- export default function ToolboxButtonWithIcon({
- children,
- icon,
- iconDisabled,
- onIconClick,
- styles
- }: Props) {
- const iconProps = {};
-
- if (iconDisabled) {
- iconProps.className = 'settings-button-small-icon settings-button-small-icon--disabled';
- } else {
- iconProps.className = 'settings-button-small-icon';
- iconProps.onClick = onIconClick;
- }
-
- return (
- <div
- className = 'settings-button-container'
- styles = { styles }>
- { children }
- <Icon
- { ...iconProps }
- size = { 9 }
- src = { icon } />
- </div>
- );
- }
|