feat: modify routing to nested mode and rename document (#52)
* feat: modify routing to nested mode * feat: rename document
This commit is contained in:
0
web/src/components/deleting-confirm/index.less
Normal file
0
web/src/components/deleting-confirm/index.less
Normal file
28
web/src/components/deleting-confirm/index.tsx
Normal file
28
web/src/components/deleting-confirm/index.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { ExclamationCircleFilled } from '@ant-design/icons';
|
||||
import { Modal } from 'antd';
|
||||
|
||||
const { confirm } = Modal;
|
||||
|
||||
interface IProps {
|
||||
onOk?: (...args: any[]) => any;
|
||||
onCancel?: (...args: any[]) => any;
|
||||
}
|
||||
|
||||
export const showDeleteConfirm = ({ onOk, onCancel }: IProps) => {
|
||||
confirm({
|
||||
title: 'Are you sure delete this item?',
|
||||
icon: <ExclamationCircleFilled />,
|
||||
content: 'Some descriptions',
|
||||
okText: 'Yes',
|
||||
okType: 'danger',
|
||||
cancelText: 'No',
|
||||
onOk() {
|
||||
onOk?.();
|
||||
},
|
||||
onCancel() {
|
||||
onCancel?.();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export default showDeleteConfirm;
|
||||
24
web/src/components/modal-manager.tsx
Normal file
24
web/src/components/modal-manager.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
interface IProps {
|
||||
children: (props: {
|
||||
showModal(): void;
|
||||
hideModal(): void;
|
||||
visible: boolean;
|
||||
}) => React.ReactNode;
|
||||
}
|
||||
|
||||
const ModalManager = ({ children }: IProps) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
const showModal = () => {
|
||||
setVisible(true);
|
||||
};
|
||||
const hideModal = () => {
|
||||
setVisible(false);
|
||||
};
|
||||
|
||||
return children({ visible, showModal, hideModal });
|
||||
};
|
||||
|
||||
export default ModalManager;
|
||||
Reference in New Issue
Block a user