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"> <
11 lines (10 loc) • 798 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import classNames from 'classnames';
import { useContext } from 'react';
import { HiMoon, HiSun } from 'react-icons/hi';
import { ThemeContext, useTheme } from '../Flowbite/ThemeContext';
export const DarkThemeToggle = ({ className, ...props }) => {
const theme = useTheme().theme.darkThemeToggle;
const { mode, toggleMode } = useContext(ThemeContext);
return (_jsx("button", { className: classNames(theme.base, className), "data-testid": "dark-theme-toggle", onClick: toggleMode, type: "button", "aria-label": "Toggle dark mode", ...props, children: mode === 'dark' ? (_jsx(HiSun, { "aria-label": "Currently dark mode", className: theme.icon })) : (_jsx(HiMoon, { "aria-label": "Currently light mode", className: theme.icon })) }));
};