From c91b1bbe8619b3b59083c62820e18b32df668416 Mon Sep 17 00:00:00 2001 From: Jordan Isip Date: Mon, 26 Feb 2024 17:49:41 -0500 Subject: [PATCH] Styling drawers and template tabs --- .../ConfigurationPanel/index.tsx | 2 +- .../input-panels/helpers/BaseSidebarPanel.tsx | 2 +- .../ToggleInspectorPanelButton.tsx | 15 ++++- .../src/App/InspectorDrawer/index.tsx | 2 +- .../ToggleSamplesPanelButton.tsx | 15 ++++- .../src/App/SamplesDrawer/index.tsx | 55 +++++++++++++++---- .../src/App/TemplatePanel/index.tsx | 31 +++++++---- .../block-wrappers/EditorBlockWrapper.tsx | 4 +- .../helpers/block-wrappers/TuneMenu.tsx | 1 - .../src/documents/editor/EditorContext.tsx | 4 +- .../sample/one-time-passcode.ts | 2 +- 11 files changed, 97 insertions(+), 36 deletions(-) diff --git a/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/index.tsx b/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/index.tsx index 8eb9069..eea3fbd 100644 --- a/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/index.tsx +++ b/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/index.tsx @@ -29,7 +29,7 @@ export default function ConfigurationPanel() { const [{ document, selectedBlockId }, setEditorState] = useEditorState(); if (!selectedBlockId) { - return renderMessage('No block selected. Click on a block to inspect.'); + return renderMessage('Click on a block to inspect.'); } const block = document[selectedBlockId]; if (!block) { diff --git a/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/input-panels/helpers/BaseSidebarPanel.tsx b/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/input-panels/helpers/BaseSidebarPanel.tsx index eba8c56..284b829 100644 --- a/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/input-panels/helpers/BaseSidebarPanel.tsx +++ b/packages/editor-sample/src/App/InspectorDrawer/ConfigurationPanel/input-panels/helpers/BaseSidebarPanel.tsx @@ -8,7 +8,7 @@ type SidebarPanelProps = { }; export default function BaseSidebarPanel({ title, children }: SidebarPanelProps) { return ( - + {title} diff --git a/packages/editor-sample/src/App/InspectorDrawer/ToggleInspectorPanelButton.tsx b/packages/editor-sample/src/App/InspectorDrawer/ToggleInspectorPanelButton.tsx index 84495be..7f10c56 100644 --- a/packages/editor-sample/src/App/InspectorDrawer/ToggleInspectorPanelButton.tsx +++ b/packages/editor-sample/src/App/InspectorDrawer/ToggleInspectorPanelButton.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { Button } from '@mui/material'; +import { AppRegistrationOutlined, LastPageOutlined } from '@mui/icons-material'; +import { IconButton } from '@mui/material'; import { useEditorState } from '../../documents/editor/EditorContext'; @@ -10,7 +11,15 @@ export default function ToggleInspectorPanelButton() { setEditorState({ inspectorDrawerOpen: !inspectorDrawerOpen }); }; if (inspectorDrawerOpen) { - return ; + return ( + + + + ); } - return ; + return ( + + + + ); } diff --git a/packages/editor-sample/src/App/InspectorDrawer/index.tsx b/packages/editor-sample/src/App/InspectorDrawer/index.tsx index f659566..3ec6014 100644 --- a/packages/editor-sample/src/App/InspectorDrawer/index.tsx +++ b/packages/editor-sample/src/App/InspectorDrawer/index.tsx @@ -7,7 +7,7 @@ import { useEditorState } from '../../documents/editor/EditorContext'; import ConfigurationPanel from './ConfigurationPanel'; import StylesPanel from './StylesPanel'; -export const INSPECTOR_DRAWER_WIDTH = 400; +export const INSPECTOR_DRAWER_WIDTH = 240; export default function InspectorDrawer() { const [{ selectedSidebarTab, inspectorDrawerOpen }, setEditorState] = useEditorState(); diff --git a/packages/editor-sample/src/App/SamplesDrawer/ToggleSamplesPanelButton.tsx b/packages/editor-sample/src/App/SamplesDrawer/ToggleSamplesPanelButton.tsx index fe672cb..f470c5a 100644 --- a/packages/editor-sample/src/App/SamplesDrawer/ToggleSamplesPanelButton.tsx +++ b/packages/editor-sample/src/App/SamplesDrawer/ToggleSamplesPanelButton.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { Button } from '@mui/material'; +import { FirstPageOutlined, MenuOutlined } from '@mui/icons-material'; +import { IconButton } from '@mui/material'; import { useEditorState } from '../../documents/editor/EditorContext'; @@ -10,7 +11,15 @@ export default function ToggleSamplesPanelButton() { setEditorState({ samplesDrawerOpen: !samplesDrawerOpen }); }; if (samplesDrawerOpen) { - return ; + return ( + + + + ); } - return ; + return ( + + + + ); } diff --git a/packages/editor-sample/src/App/SamplesDrawer/index.tsx b/packages/editor-sample/src/App/SamplesDrawer/index.tsx index 7f7799a..15d0059 100644 --- a/packages/editor-sample/src/App/SamplesDrawer/index.tsx +++ b/packages/editor-sample/src/App/SamplesDrawer/index.tsx @@ -1,10 +1,10 @@ import React from 'react'; -import { Box, Button, Drawer } from '@mui/material'; +import { Button, Drawer, Stack } from '@mui/material'; import { useEditorState } from '../../documents/editor/EditorContext'; -export const SAMPLES_DRAWER_WIDTH = 400; +export const SAMPLES_DRAWER_WIDTH = 240; export default function SamplesDrawer() { const [{ samplesDrawerOpen }] = useEditorState(); @@ -22,15 +22,48 @@ export default function SamplesDrawer() { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0, }} > - - - - - - - - - + + + + + + + + + + + + + ); } diff --git a/packages/editor-sample/src/App/TemplatePanel/index.tsx b/packages/editor-sample/src/App/TemplatePanel/index.tsx index edb4a95..75ee89b 100644 --- a/packages/editor-sample/src/App/TemplatePanel/index.tsx +++ b/packages/editor-sample/src/App/TemplatePanel/index.tsx @@ -39,22 +39,33 @@ export default function TemplatePanel() { return ( <> - setEditorState({ selectedMainTab: v })}> - - - - - - + + setEditorState({ selectedMainTab: v })}> + + + + + + - - + + + {renderMainPanel()} diff --git a/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/EditorBlockWrapper.tsx b/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/EditorBlockWrapper.tsx index d6b0ac4..46ca343 100644 --- a/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/EditorBlockWrapper.tsx +++ b/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/EditorBlockWrapper.tsx @@ -18,9 +18,9 @@ export default function EditorBlockWrapper({ children }: TEditorBlockWrapperProp let outline: CSSProperties['outline']; if (selectedBlockId === blockId) { - outline = '2px solid blue'; + outline = '2px solid rgba(0,121,204, 1)'; } else if (mouseInside) { - outline = '2px dashed blue'; + outline = '2px solid rgba(0,121,204, 0.3)'; } const renderMenu = () => { diff --git a/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/TuneMenu.tsx b/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/TuneMenu.tsx index 367fd47..b086ec5 100644 --- a/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/TuneMenu.tsx +++ b/packages/editor-sample/src/documents/blocks/helpers/block-wrappers/TuneMenu.tsx @@ -12,7 +12,6 @@ const STYLE: CSSProperties = { top: 0, left: -52, borderRadius: 64, - padding: '8px 4px', }; type Props = { diff --git a/packages/editor-sample/src/documents/editor/EditorContext.tsx b/packages/editor-sample/src/documents/editor/EditorContext.tsx index db6adc0..4c2fbc7 100644 --- a/packages/editor-sample/src/documents/editor/EditorContext.tsx +++ b/packages/editor-sample/src/documents/editor/EditorContext.tsx @@ -20,8 +20,8 @@ const DEFAULT_STATE: TValue = { selectedSidebarTab: 'styles', selectedMainTab: 'editor', - inspectorDrawerOpen: false, - samplesDrawerOpen: false, + inspectorDrawerOpen: true, + samplesDrawerOpen: true, }; const EditorContext = createContext([DEFAULT_STATE, () => {}]); diff --git a/packages/editor-sample/src/getConfiguration/sample/one-time-passcode.ts b/packages/editor-sample/src/getConfiguration/sample/one-time-passcode.ts index 5df1ca7..d1ce74a 100644 --- a/packages/editor-sample/src/getConfiguration/sample/one-time-passcode.ts +++ b/packages/editor-sample/src/getConfiguration/sample/one-time-passcode.ts @@ -23,7 +23,7 @@ const ONE_TIME_PASSCODE: TEditorConfiguration = { style: { backgroundColor: null, padding: { - top: 48, + top: 24, bottom: 24, left: 24, right: 24,