import React, { useState } from "react"; import PropTypes from "prop-types"; import { Modal } from "../"; import { IModalProps } from "../modal/modal.d"; import Button from "./button"; import Content from "./content"; import Context from "./dialog-context"; import Footer from "./footer"; import Header from "./header"; import Tab from "./tab"; import Tabs from "./tabs"; import Attention from "./attention"; export interface IDialogProps { loading?: boolean; } interface IDialogStatic { Button: typeof Button; Content: typeof Content; Footer: typeof Footer; Header: typeof Header; Tab: typeof Tab; Tabs: typeof Tabs; Attention: typeof Attention; } const Dialog: React.FC & IDialogStatic = props => { const { children, loading, onClose, size } = props; const dataTestId = props["data-testid"] || "honey-ui-dialog"; const [dialogExpanded, changeDialogExpanded] = useState(false); return ( onClose()} size={dialogExpanded ? "xl" : size} > <> {children} {loading && (
{/* TODO use honeyUI loader */}
)} ); }; Dialog.displayName = "Dialog"; Dialog.propTypes = { className: PropTypes.string, isCentered: PropTypes.bool, isCloseOnEscapeKey: PropTypes.bool, isFocusOnFirstFocusableEl: PropTypes.bool, isRelative: PropTypes.bool, isScrollable: PropTypes.bool, loading: PropTypes.bool, onClose: PropTypes.func.isRequired, size: PropTypes.oneOf(["xl", "lg", "sm", "initial"]) }; Dialog.defaultProps = { isScrollable: true, size: "lg" }; Dialog.Button = Button; Dialog.Content = Content; Dialog.Footer = Footer; Dialog.Header = Header; Dialog.Tab = Tab; Dialog.Tabs = Tabs; Dialog.Attention = Attention; export default Dialog;