chore: add modal

This commit is contained in:
jialin
2024-05-20 15:43:26 +08:00
parent eeab170970
commit 313da7a9d2
10 changed files with 361 additions and 86 deletions
@@ -0,0 +1,35 @@
import * as icons from '@ant-design/icons';
import { Button, Dropdown, Space } from 'antd';
import type { MenuProps } from 'antd/es/menu';
import react from 'react';
type DropdownProps = {
trigger?: Array<'click' | 'hover' | 'contextMenu'>;
items: MenuProps['items'];
onClick: (e: any) => void;
};
const renderIcon = (icon: string) => {
if (!icon) {
return null;
}
// @ts-ignore
const Icon = icons[icon] as React.FC;
return react.createElement(Icon);
};
const DropDownActions: React.FC<DropdownProps> = (props) => {
const { trigger, items, onClick } = props;
return (
<Space>
<Dropdown menu={{ items, onClick }} trigger={trigger}>
<Button
onClick={(e) => e.preventDefault()}
style={{ fontSize: '14px' }}
type="text"
icon={renderIcon('MoreOutlined')}
></Button>
</Dropdown>
</Space>
);
};
export default DropDownActions;
+20
View File
@@ -0,0 +1,20 @@
import { Button, Space } from 'antd';
type ModalFooterProps = {
onOk: () => void;
onCancel: () => void;
};
const ModalFooter: React.FC<ModalFooterProps> = ({ onOk, onCancel }) => {
return (
<Space size={20}>
<Button onClick={onCancel} style={{ width: '88px' }}>
</Button>
<Button type="primary" onClick={onOk} style={{ width: '88px' }}>
</Button>
</Space>
);
};
export default ModalFooter;
+2
View File
@@ -39,6 +39,7 @@ const SealSelect: React.FC<SelectProps & SealFormItemProps> = (props) => {
};
const handleOnBlur = (e: any) => {
setIsFocus(false);
props.onBlur?.(e);
};
@@ -61,6 +62,7 @@ const SealSelect: React.FC<SelectProps & SealFormItemProps> = (props) => {
onBlur={handleOnBlur}
onSearch={handleOnSearch}
onChange={handleChange}
notFoundContent={null}
>
{children}
</Select>