import "./ToolIcon.scss"; import React from "react"; import { t } from "../i18n"; import { ToolButton } from "./ToolButton"; export type Appearence = "light" | "dark"; // We chose to use only explicit toggle and not a third option for system value, // but this could be added in the future. export const DarkModeToggle = (props: { value: Appearence; onChange: (value: Appearence) => void; title?: string; }) => { const title = props.title || (props.value === "dark" ? t("buttons.lightMode") : t("buttons.darkMode")); return ( props.onChange(props.value === "dark" ? "light" : "dark")} data-testid="toggle-dark-mode" /> ); }; const ICONS = { SUN: ( ), MOON: ( ), };