import React, { useState } from 'react';
import withPropsCombinations from 'react-storybook-addon-props-combinations';
import { strings, numbers, cssClasses } from '@douyinfe/semi-foundation/button/constants';
import Button from '../index';
import ButtonGroup from '../buttonGroup';
import SplitButtonGroup from '../splitButtonGroup';
import Dropdown from '../../dropdown';
import { Tooltip, Switch } from '@douyinfe/semi-ui';
import {
IconTick,
IconEdit,
IconTwitter,
IconUser,
IconCopy,
IconSearch,
IconPlay,
} from '@douyinfe/semi-icons';
import Collapse from '../../collapse';
export default {
title: 'Button',
}
export const Primary = () => ;
export const Danger = () => ;
export const Warning = () => ;
export const WithIcon = () => (
<>
}>hello button
} noHorizontalPadding={false} ghost={false}>
Edit me
} />
>
);
export const CombinationShow = withPropsCombinations(
Button,
{
disabled: [false, true],
children: ['hello button'],
size: strings.sizes,
type: strings.btnTypes,
theme: strings.themes, // block: [false, true],
// ghost: [false, true],
// light: [false, true],
},
{
showSource: false,
}
);
export const ButtonGroupDemo = () => (
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'} />
} theme={'solid'}>
拷贝
} theme={'solid'}>
搜索
} theme={'solid'}>
播放
} theme={'solid'}>
拷贝
} theme={'solid'}>
搜索
} theme={'solid'}>
播放
} theme={'solid'}>
拷贝
} theme={'solid'}>
搜索
} theme={'solid'}>
播放
ButtonGroup children 不是合法元素的情况:
{false}
{123}
{null}
{undefined}
text
span
{true && }
);
export function Loading() {
const [loading, setLoading] = useState(false);
return (
setLoading(loading)} />
} loading={loading} />
} loading={loading} />
} loading={loading} theme="solid" />
} loading={loading} theme="solid" type="danger" />
} loading={loading} theme="solid" type="warning" disabled />
);
};
const menu = [
{
node: 'title',
name: '标题一',
},
{
node: 'item',
name: '编辑项目',
onClick: () => console.log('编辑项目点击'),
},
{
node: 'item',
name: '重置项目',
type: 'secondary',
},
{
node: 'divider',
},
{
node: 'item',
name: '从项目创建模版',
type: 'tertiary',
},
{
node: 'item',
name: '复制项目',
type: 'warning',
},
{
node: 'divider',
},
{
node: 'item',
name: '删除项目',
type: 'danger',
},
];
const content = '批量通过';
export const SplitButton = () => (
<>
基础
}>
>
);
export const StopPropagationWhenDisabled = () => (
<>
title
>
}
itemKey="1"
>
Hi, bytedance dance dance. This is the docsite of Semi UI.
title
>
}
itemKey="2"
>
Hi, bytedance dance dance. This is the docsite of Semi UI.
console.log('div')}>
正常冒泡
console.log('div')}>
禁用 Button 后,阻止冒泡
>
);