import React, { useState } from 'react'; import Popconfirm from '../index'; import Button from '../../button'; import Input from '../../input'; import Table from '../../table'; import Toast from '../../toast'; import TypesConfrimDemo from './TypesConfirm'; import DynamicDisableDemo from './DynamicDisable'; import TitleConfirmDemo from './TitlePopconfirm'; import InTableDemo from './InTable'; import ShowArrow from './ShowArrow'; export default { title: 'Popconfirm', parameters: { chromatic: { disableSnapshot: true }, }, } let style = { display: 'inline-block', padding: '20px', }; export const Simple = () => (
Delete
); Simple.story = { name: 'simple', }; export const _Button = () => (
); _Button.story = { name: 'button', }; const dataSource = [ { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park, New York No. 1 Lake Park', }, { key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', }, { key: '3', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park', }, { key: '4', name: 'Disabled User', age: 99, address: 'Sidney No. 1 Lake Park', }, ]; const columns = [ { title: 'Name', dataIndex: 'name', render: text => ( ), }, { title: 'Age', dataIndex: 'age', }, { title: 'Address', dataIndex: 'address', }, ]; export const _Table = () => (
); _Table.story = { name: 'table', }; export const TypesConfirm = () => ; TypesConfirm.story = { name: 'types-confirm', }; export const DynamicDisable = () => ; DynamicDisable.story = { name: 'dynamic disable', }; export const TitlePopconfirm = () => ; TitlePopconfirm.story = { name: 'title popconfirm', }; export const InTable = () => ; InTable.story = { name: 'in table', }; export const ShowArrowDemo = () => ; ShowArrowDemo.style = { name: 'show arrow' } export const ClickOutSideDemo = () => { const [v, setV] = useState(false) const onConfirm = () => { Toast.success('确认保存!'); }; const onCancel = () => { Toast.warning('取消保存!'); } return ( ) } ClickOutSideDemo.story = { name: 'ClickOutSideDemo', }; export const PromiseCallback = () => { const onConfirm = () => { return new Promise((resolve, reject) => { setTimeout(() => { console.log('ccc'); resolve(1); }, 2000) }) }; const onCancel = () => { return new Promise((resolve, reject) => { setTimeout(() => { console.log('ccc'); reject(1); }, 2000) }) }; return ( ); }; PromiseCallback.story = { name: 'PromiseCallbackDemo', };