From c624fbcba3a64bbc8a25f34d37380c7ff2460bfc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 17 Dec 2022 20:16:05 -0600 Subject: [PATCH] ThemeEditor: allow exporting a theme --- app/soapbox/features/theme-editor/index.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/soapbox/features/theme-editor/index.tsx b/app/soapbox/features/theme-editor/index.tsx index efedfce3d..c466bec6a 100644 --- a/app/soapbox/features/theme-editor/index.tsx +++ b/app/soapbox/features/theme-editor/index.tsx @@ -8,13 +8,16 @@ import snackbar from 'soapbox/actions/snackbar'; import { fetchSoapboxConfig } from 'soapbox/actions/soapbox'; import List, { ListItem } from 'soapbox/components/list'; import { Button, Column, Form, FormActions } from 'soapbox/components/ui'; +import DropdownMenuContainer from 'soapbox/containers/dropdown-menu-container'; import { useAppDispatch, useAppSelector, useSoapboxConfig } from 'soapbox/hooks'; +import { download } from 'soapbox/utils/download'; import Palette, { ColorGroup } from './components/palette'; const messages = defineMessages({ title: { id: 'admin.theme.title', defaultMessage: 'Theme' }, saved: { id: 'theme_editor.saved', defaultMessage: 'Theme updated!' }, + export: { id: 'theme_editor.export', defaultMessage: 'Export theme' }, }); interface IThemeEditor { @@ -55,6 +58,11 @@ const ThemeEditor: React.FC = () => { await dispatch(updateSoapboxConfig(params)); }; + const exportTheme = () => { + const data = JSON.stringify(colors, null, 2); + download(data, 'theme.json'); + }; + const handleSubmit = async() => { setSubmitting(true); @@ -116,6 +124,12 @@ const ThemeEditor: React.FC = () => { +