import React, { useState } from 'react';
import { Icon, Radio, RadioGroup, Button, ButtonGroup, Switch } from '@douyinfe/semi-ui/';
import Popconfirm from '../..';
import { IconAlertTriangle } from '@douyinfe/semi-icons';
const defaultTitle =
'确定是否要保存此修改?确定是否要保存此修改?确定是否要保存此修改?确定是否要保存此修改?确定是否要保存此修改?确定是否要保存此修改?确定是否要保存此修改?';
const defaultContent =
'此修改将不可逆此修改将不可逆此修改将不可逆此修改将不可逆此修改将不可逆此修改将不可逆此修改将不可逆此修改将不可逆此修改将不可逆';
const typeMap = {
default: {
okType: 'primary',
cancelType: 'primary',
icon: ,
},
warning: {
okType: 'warning',
cancelType: 'warning',
icon: (
),
},
danger: {
okType: 'danger',
cancelType: 'danger',
icon: (
),
},
tertiary: {
okType: 'tertiary',
cancelType: 'tertiary',
icon: (
),
},
};
function Demo(props = {}) {
const keys = Object.keys(typeMap);
const [type, setType] = useState('default');
const [title, setTitle] = useState(defaultTitle);
const [content, setContent] = useState(defaultContent);
const [icon, setIcon] = useState(typeMap[type].icon);
const [visible, _setVisible] = useState(true);
const changeType = e => {
const type = e && e.target && e.target.value;
if (type && keys.includes(type)) {
setType(type);
}
};
const setVisible = visible => _setVisible(visible);
const toggleVisible = () => setVisible(!visible);
const toggleTitle = () => setTitle(title ? null : defaultTitle);
const toggleContent = () => setContent(content ? null : defaultContent);
const toggleIcon = () => setIcon(icon ? null : typeMap[type].icon);
return (
{keys.map(key => (
{key}
))}
);
}
export default Demo;