diff --git a/packages/app/src/debugComponents/index.js b/packages/app/src/debugComponents/index.js new file mode 100644 index 00000000..0d8cdebd --- /dev/null +++ b/packages/app/src/debugComponents/index.js @@ -0,0 +1 @@ +export { default as ThemeDebug } from "./theme" \ No newline at end of file diff --git a/packages/app/src/debugComponents/theme/index.jsx b/packages/app/src/debugComponents/theme/index.jsx new file mode 100644 index 00000000..4eac7da2 --- /dev/null +++ b/packages/app/src/debugComponents/theme/index.jsx @@ -0,0 +1,56 @@ +import React from "react" +import * as antd from "antd" +import ReactJSON from "react-json-view" + +import { Theme } from "extensions" + +import "./index.less" + +export default class ThemeDebug extends React.Component { + state = { + currentVariant: null, + rootVariables: null, + } + + componentDidMount = async () => { + await this.setValues() + } + + setValues = async () => { + const currentVariant = document.documentElement.style.getPropertyValue("--themeVariant") + const rootVariables = window.app.ThemeController.getRootVariables() + + this.setState({ currentVariant, rootVariables }) + } + + editValues = async (values) => { + console.log(values) + await window.app.ThemeController.update({ [values.name]: values.new_value }) + await this.setState({ rootVariables: values.updated_src }) + } + + setDefaults = async () => { + await window.app.ThemeController.resetDefault() + await this.setValues() + } + + render() { + return