From 3b1d8972b0d4dde08f27ae544647a6e42657e144 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 25 Oct 2022 16:56:25 -0500 Subject: [PATCH] Scaffold theme editor --- .../components/color-with-picker.tsx | 9 +-- app/soapbox/features/soapbox_config/index.tsx | 4 +- .../theme-editor/components/palette.tsx | 41 ++++++++++ app/soapbox/features/theme-editor/index.tsx | 74 +++++++++++++++++++ app/soapbox/features/ui/index.tsx | 2 + .../features/ui/util/async-components.ts | 4 + 6 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 app/soapbox/features/theme-editor/components/palette.tsx create mode 100644 app/soapbox/features/theme-editor/index.tsx diff --git a/app/soapbox/features/soapbox_config/components/color-with-picker.tsx b/app/soapbox/features/soapbox_config/components/color-with-picker.tsx index c82e1bf11..70ccb624b 100644 --- a/app/soapbox/features/soapbox_config/components/color-with-picker.tsx +++ b/app/soapbox/features/soapbox_config/components/color-with-picker.tsx @@ -9,12 +9,12 @@ import ColorPicker from './color-picker'; import type { ColorChangeHandler } from 'react-color'; interface IColorWithPicker { - buttonId: string, value: string, onChange: ColorChangeHandler, + className?: string, } -const ColorWithPicker: React.FC = ({ buttonId, value, onChange }) => { +const ColorWithPicker: React.FC = ({ value, onChange, className }) => { const node = useRef(null); const [active, setActive] = useState(false); const [placement, setPlacement] = useState(null); @@ -39,11 +39,10 @@ const ColorWithPicker: React.FC = ({ buttonId, value, onChange }; return ( -
+
}> + + + ); +}; + +export default ThemeEditor; \ No newline at end of file diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 08d96e920..c5a9bb422 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -112,6 +112,7 @@ import { TestTimeline, LogoutPage, AuthTokenList, + ThemeEditor, } from './util/async-components'; import { WrappedRoute } from './util/react_router_helpers'; @@ -306,6 +307,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { + diff --git a/app/soapbox/features/ui/util/async-components.ts b/app/soapbox/features/ui/util/async-components.ts index f416c859a..84053f24a 100644 --- a/app/soapbox/features/ui/util/async-components.ts +++ b/app/soapbox/features/ui/util/async-components.ts @@ -310,6 +310,10 @@ export function ModerationLog() { return import(/* webpackChunkName: "features/admin/moderation_log" */'../../admin/moderation_log'); } +export function ThemeEditor() { + return import(/* webpackChunkName: "features/theme-editor" */'../../theme-editor'); +} + export function UserPanel() { return import(/* webpackChunkName: "features/ui" */'../components/user_panel'); }