mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-28 03:23:02 +00:00
26 lines
703 B
TypeScript
26 lines
703 B
TypeScript
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>
|
|
);
|
|
}
|