@carbon/ibm-security
Version:
Carbon for Cloud & Cognitive IBM Security UI components
51 lines (50 loc) • 2.2 kB
JavaScript
/**
* @file Icon button stories.
* @copyright IBM Security 2019 - 2021
*/
import { Add16 } from '@carbon/icons-react';
import { action } from '@storybook/addon-actions';
import { select, text, boolean } from '@storybook/addon-knobs';
import { storiesOf } from '@storybook/react';
import React from 'react';
import { components } from '../../../.storybook';
import { className, iconClassName, label, sizes } from './_mocks_';
import { IconButton } from '../..';
import { TooltipDirection } from './IconButton';
import { InlineNotification, NotificationActionButton } from '../../';
import { Grid } from 'carbon-components-react';
var iconButtonProps = function iconButtonProps() {
return {
className: className,
disabled: boolean('disabled', false),
iconClassName: iconClassName,
label: text('label', label),
onClick: action('onClick'),
renderIcon: Add16,
size: select('size', sizes, sizes[0]),
tooltip: boolean('tooltip', IconButton.defaultProps.tooltip),
tooltipDirection: select('tooltipDirection', Object.keys(TooltipDirection).map(function (direction) {
return TooltipDirection[direction];
}), IconButton.defaultProps.tooltipDirection)
};
};
storiesOf(components('IconButton#legacy'), module).addDecorator(function (Story) {
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InlineNotification, {
className: "page-layouts__banner",
actions: /*#__PURE__*/React.createElement(NotificationActionButton, {
href: "https://react.carbondesignsystem.com/?path=/story/components-button--icon-button",
rel: "noopener noreferrer",
target: "_blank"
}, "View replacement"),
kind: "info",
subtitle: "Component no longer supported. The component will remain available, but plan to migrate to the component replacement.",
title: "",
hideCloseButton: true
}), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Story, null)));
}).add('Default', function () {
return /*#__PURE__*/React.createElement(IconButton, iconButtonProps());
}, {
info: {
text: "\n Basic implementation of an Icon Button component.\n "
}
});