mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-28 11:33:02 +00:00
refactor: batch 2
This commit is contained in:
25
src/components/InfoModal.tsx
Normal file
25
src/components/InfoModal.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Dialog } from '~/components/Dialog.tsx';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
interface InfoModalProps {
|
||||
title?: React.ReactNode;
|
||||
description?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export function InfoModal(props: InfoModalProps) {
|
||||
const { title, description, children } = props;
|
||||
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
return (
|
||||
<div>
|
||||
<button className="btn btn-info btn-sm" type="button" onClick={() => setShowModal(true)}>
|
||||
{children || '这是什么?'}
|
||||
</button>
|
||||
|
||||
<Dialog closeButton backdropClose show={showModal} onClose={() => setShowModal(false)} title={title}>
|
||||
{description}
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user