hoda-react
Version:
<div align="center"> <h1>:construction: flowbite-react (unreleased) :construction:</h1> <p> <a href="https://flowbite-react.com"> <img alt="Flowbite - Tailwind CSS components" width="350" src=".github/assets/flowbite-react-github.png"> <
15 lines (14 loc) • 762 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import classNames from 'classnames';
import { HiX } from 'react-icons/hi';
import { useTheme } from '../Flowbite/ThemeContext';
import { useToastContext } from './ToastContext';
export const ToastToggle = ({ className, xIcon: XIcon = HiX }) => {
const { duration, isClosed, isRemoved, setIsClosed, setIsRemoved } = useToastContext();
const theme = useTheme().theme.toast.toggle;
const handleClick = () => {
setIsClosed(!isClosed);
setTimeout(() => setIsRemoved(!isRemoved), duration);
};
return (_jsx("button", { "aria-label": "Close", onClick: handleClick, type: "button", className: classNames(theme.base, className), children: _jsx(XIcon, { className: theme.icon }) }));
};