/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { ReactElement } from "react"; import { FluentReactComponents } from "../FluentUi.cjs"; import { useTelemetryOptIn } from "../TelemetryUtils.js"; import { ThemeOption, useThemeContext } from "../ThemeHelper.js"; const { Dropdown, Link, Option, Switch, makeStyles, teamsHighContrastTheme, webDarkTheme, webLightTheme, } = FluentReactComponents; const useStyles = makeStyles({ root: { justifyItems: "start", height: "100%", width: "100%", }, /** * Styles to apply to sections (groupings of related options, with a header) */ section: { display: "flex", flexDirection: "column", }, /** * Styles to apply to section headers */ sectionHeader: { fontWeight: "bold", }, /** * Styles to apply to option entries within a section (container around label and value) */ option: { display: "flex", flexDirection: "column", }, /** * Styles to apply to settings option drop-downs */ dropdown: { width: "180px", }, }); /** * Settings page for the devtools. * * @remarks {@link ThemeContext} must be set in order to use this component. */ export function SettingsView(): ReactElement { const { themeInfo, setTheme } = useThemeContext(); const styles = useStyles(); const [optedIn, setOptedIn] = useTelemetryOptIn(); function handleThemeChange( _event, option: { optionValue: string | undefined; optionText: string | undefined; selectedOptions: string[]; }, ): void { switch (option.optionValue) { case ThemeOption.Light: { setTheme({ name: ThemeOption.Light, theme: webLightTheme, }); break; } case ThemeOption.Dark: { setTheme({ name: ThemeOption.Dark, theme: webDarkTheme, }); break; } case ThemeOption.HighContrast: { setTheme({ name: ThemeOption.HighContrast, theme: teamsHighContrastTheme, }); break; } default: { setTheme({ name: ThemeOption.Dark, theme: webDarkTheme, }); break; } } } return (

Theme

Usage telemetry

Microsoft Privacy Statement setOptedIn(data.checked)} />
); }