diff --git a/src/Components/Modal/Modal.tsx b/src/Components/Modal/Modal.tsx index 84be855..6b78320 100644 --- a/src/Components/Modal/Modal.tsx +++ b/src/Components/Modal/Modal.tsx @@ -59,7 +59,7 @@ const Modal = ({ isOpen, onClose, maxWidth = 'lg', children }: PropsWithChildren >
@@ -75,7 +75,12 @@ const Modal = ({ isOpen, onClose, maxWidth = 'lg', children }: PropsWithChildren const ModalHeader = ({ children, className }: PropsWithChildren<{ className?: string }>) => { return ( -
+
{children}
); diff --git a/src/Components/Notice/Notice.tsx b/src/Components/Notice/Notice.tsx index 9cfb3fc..5f66d41 100644 --- a/src/Components/Notice/Notice.tsx +++ b/src/Components/Notice/Notice.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { twMerge } from 'tailwind-merge'; import { ExclamationTriangleIcon, @@ -6,25 +6,27 @@ import { CheckCircleIcon, InformationCircleIcon, } from '@heroicons/react/20/solid'; +import { XMarkIcon } from '@heroicons/react/24/outline'; export interface NoticeProps { label?: React.ReactNode; type?: 'success' | 'warning' | 'error' | 'info'; className?: string; children?: React.ReactNode; + dismissible?: boolean; } const getNoticeColor = (type: NoticeProps['type']) => { switch (type) { case 'warning': - return 'bg-yellow-50 text-yellow-800 ring-yellow-600/20'; + return 'bg-yellow-50 text-yellow-800 ring-yellow-600/20 dark:bg-yellow-700 dark:text-yellow-200 dark:ring-yellow-500/50'; case 'error': - return 'bg-red-50 text-red-700 ring-red-600/10'; + return 'bg-red-50 text-red-700 ring-red-600/10 dark:bg-red-700 dark:text-red-200 dark:ring-red-500/50'; case 'info': - return 'bg-blue-50 text-blue-700 ring-blue-700/10'; + return 'bg-blue-50 text-blue-700 ring-blue-700/10 dark:bg-blue-700 dark:text-blue-200 dark:ring-blue-500/50'; case 'success': default: - return 'bg-green-50 text-green-700 ring-green-600/20'; + return 'bg-green-50 text-green-700 ring-green-600/20 dark:bg-green-700 dark:text-green-200 dark:ring-green-500/50'; } }; @@ -42,17 +44,38 @@ const getIcon = (type: NoticeProps['type']) => { } }; -const Notice: React.FC = ({ label, type = 'success', className, children }) => { +const Notice: React.FC = ({ + label, + type = 'success', + className, + dismissible = false, + children, +}) => { + const [isVisible, setIsVisible] = useState(true); const color = getNoticeColor(type); + if (!isVisible) return null; + return (
-
-
{getIcon(type)}
-
- {label &&

{label}

} - {children &&
{children}
} +
+
+
{getIcon(type)}
+
+ {label &&

{label}

} + {children &&
{children}
} +
+ + {dismissible && ( + + )}
); diff --git a/src/Components/SwitchInput/SwitchInput.tsx b/src/Components/SwitchInput/SwitchInput.tsx index 8c9a492..6c5bc0e 100644 --- a/src/Components/SwitchInput/SwitchInput.tsx +++ b/src/Components/SwitchInput/SwitchInput.tsx @@ -8,6 +8,7 @@ type Props = { initialValue?: boolean; help?: ReactNode; disabled?: boolean; + html?: boolean; className?: string; onChange?: (status: boolean) => void; }; @@ -17,6 +18,7 @@ const SwitchInput = ({ label, help, disabled = false, + html = false, className, onChange, }: Props) => { @@ -61,7 +63,14 @@ const SwitchInput = ({ {label} - {help &&

{help}

} + {help && !html &&

{help}

} + + {help && html && ( +

+ )}

diff --git a/src/Components/Tooltip/Tooltip.tsx b/src/Components/Tooltip/Tooltip.tsx index 82b8579..26c3542 100644 --- a/src/Components/Tooltip/Tooltip.tsx +++ b/src/Components/Tooltip/Tooltip.tsx @@ -22,7 +22,7 @@ const Tooltip: React.FC = ({ return ( - {children} + {children}