Add support for system theme (#245)

* Add support for 'system' theme value

* Add ability to set theme to 'system' in settings

* Fix tsc errors for Theme
This commit is contained in:
Frank Noirot
2023-08-09 13:57:07 -04:00
committed by GitHub
parent 8ebb8b8b94
commit 968a67e654
7 changed files with 56 additions and 35 deletions

View File

@ -1,15 +1,15 @@
import ReactJson from 'react-json-view'
import { useEffect } from 'react'
import { useStore } from '../useStore'
import { Themes, useStore } from '../useStore'
import { CollapsiblePanel, CollapsiblePanelProps } from './CollapsiblePanel'
const ReactJsonTypeHack = ReactJson as any
interface LogPanelProps extends CollapsiblePanelProps {
theme?: 'light' | 'dark'
theme?: Exclude<Themes, Themes.System>
}
export const Logs = ({ theme = 'light', ...props }: LogPanelProps) => {
export const Logs = ({ theme = Themes.Light, ...props }: LogPanelProps) => {
const { logs } = useStore(({ logs }) => ({
logs,
}))
@ -42,7 +42,10 @@ export const Logs = ({ theme = 'light', ...props }: LogPanelProps) => {
)
}
export const KCLErrors = ({ theme = 'light', ...props }: LogPanelProps) => {
export const KCLErrors = ({
theme = Themes.Light,
...props
}: LogPanelProps) => {
const { kclErrors } = useStore(({ kclErrors }) => ({
kclErrors,
}))