import React, { FC, PropsWithChildren, useState, useCallback } from 'react'; import clsx from 'clsx'; import styles from './panel.scss'; import icons from './icons.scss'; interface PanelProps extends PropsWithChildren { title?: string; icon?: string; } export const Panel: FC = ({ title, icon, children }) => { return (
{title && ( {icon && ( )} {title} )} {children}
); }; export const PanelHeader: FC> = ({ children }) => { return (
{children}
); }; export const PanelBody: FC> = ({ children }) => { return (
{children}
); }; export const PanelFooter: FC> = ({ children }) => { return (
{children}
); }; interface PanelBodyHeaderProps extends PropsWithChildren { type?: 'default' | 'error'; onClose?: () => void; } export const PanelBodyHeader: FC = ({ type = 'default', onClose, children }) => { const [isClosed, setIsClosed] = useState(false); const handleCloseClick = useCallback(() => { setIsClosed(true); onClose?.(); }, [onClose]); return (
{type === 'error' && } {children}
); }; interface PanelIconProps { icon: string; } export const PanelIcon: FC = ({ icon }) => { return (
); };