Files
Andrii ShaforostovandGitHub 960bef38eb feat: GitHub workflows and linter for new project structure (#154)
feat: GitHub workflows and linter for new project structure (#154)

Signed-off-by: andrii-codefresh <[email protected]>
2021-09-29 09:20:44 -07:00

11 lines
454 B
TypeScript

import * as React from 'react';
import {Theme, ThemeContext} from '../../shared/context/theme';
import {ActionButton} from '../action-button/action-button';
export const ThemeToggle = () => {
const dmCtx = React.useContext(ThemeContext);
const isDark = dmCtx.theme === Theme.Dark;
const icon = isDark ? 'fa-sun' : 'fa-moon';
return <ActionButton action={() => dmCtx.set(isDark ? Theme.Light : Theme.Dark)} icon={icon} dark={true} />;
};