Skip to content

Commit 7041ecd

Browse files
committed
Move toolbar buttons to the left side, add close button to slideout config
1 parent 47a99ab commit 7041ecd

2 files changed

Lines changed: 49 additions & 47 deletions

File tree

services/backend-api/client/src/pages/Previewer/ComponentTreeToolbar.tsx

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ export const ComponentTreeToolbar: React.FC = () => {
9999
</VStack>
100100
)}
101101
{!isDesktop && (
102-
<VStack
103-
align="start"
104-
spacing={1}
105-
display={{ base: "block", [MESSAGE_BUILDER_MOBILE_BREAKPOINT]: "none" }}
102+
<HStack
103+
align="center"
104+
width="100%"
105+
display={{ base: "flex", [MESSAGE_BUILDER_MOBILE_BREAKPOINT]: "none" }}
106106
>
107-
<Text fontSize="md" display="inline">
107+
<Text fontSize="md">
108108
Selected:{" "}
109109
<Text
110110
display="inline"
@@ -114,56 +114,51 @@ export const ComponentTreeToolbar: React.FC = () => {
114114
{selectedComponent ? getPreviewerComponentLabel(selectedComponent.type) : "None"}
115115
</Text>
116116
</Text>
117-
</VStack>
117+
<HStack spacing={2} flexWrap="wrap">
118+
{selectedComponent && (
119+
<Box>
120+
<AddComponentButton
121+
component={selectedComponent}
122+
canHaveChildren={!!canAddChildren}
123+
onAddChild={handleAddChild}
124+
buttonProps={{
125+
variant: "solid",
126+
colorScheme: undefined,
127+
size: "sm",
128+
}}
129+
/>
130+
</Box>
131+
)}
132+
<Button
133+
leftIcon={<FaCog />}
134+
size="sm"
135+
variant="solid"
136+
onClick={() => {
137+
if (!selectedComponent) {
138+
return;
139+
}
140+
141+
handleConfigureComponent();
142+
}}
143+
aria-disabled={!selectedComponent}
144+
>
145+
Configure
146+
</Button>
147+
</HStack>
148+
</HStack>
118149
)}
119-
<HStack spacing={2} flexWrap="wrap">
120-
{isDesktop && (
150+
{isDesktop && (
151+
<HStack spacing={2} flexWrap="wrap">
121152
<Button
122153
leftIcon={<VscCollapseAll />}
123-
size="sm"
124154
variant="ghost"
125155
onClick={handleCollapseAll}
126156
isDisabled={!messageComponent}
127157
>
128158
Collapse all
129159
</Button>
130-
)}
131-
{selectedComponent && !isDesktop && (
132-
<Box>
133-
<AddComponentButton
134-
component={selectedComponent}
135-
canHaveChildren={!!canAddChildren}
136-
onAddChild={handleAddChild}
137-
buttonProps={{
138-
variant: "solid",
139-
colorScheme: undefined,
140-
size: "sm",
141-
}}
142-
/>
143-
</Box>
144-
)}
145-
{!isDesktop && (
146-
<Button
147-
display={{
148-
base: "inline-flex",
149-
[MESSAGE_BUILDER_MOBILE_BREAKPOINT]: "none",
150-
}}
151-
leftIcon={<FaCog />}
152-
size="sm"
153-
variant="solid"
154-
onClick={() => {
155-
if (!selectedComponent) {
156-
return;
157-
}
158-
159-
handleConfigureComponent();
160-
}}
161-
aria-disabled={!selectedComponent}
162-
>
163-
Configure
164-
</Button>
165-
)}
166-
</HStack>
160+
</HStack>
161+
)}
167162
</HStack>
168163
</Box>
169164
<SlidingConfigPanel onClose={onCloseComponentConfigure} component={configuringComponent} />

services/backend-api/client/src/pages/Previewer/SlidingConfigPanel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
ModalHeader,
77
ModalCloseButton,
88
ModalBody,
9+
ModalFooter,
10+
Button,
911
} from "@chakra-ui/react";
1012
import { ComponentPropertiesPanel } from "./ComponentPropertiesPanel";
1113
import getPreviewerComponentLabel from "./utils/getPreviewerComponentLabel";
@@ -52,7 +54,7 @@ export const SlidingConfigPanel: React.FC<SlidingConfigPanelProps> = ({ onClose,
5254
Configure {component ? getPreviewerComponentLabel(component.type) : "Component"}
5355
</ModalHeader>
5456
<ModalCloseButton color="gray.400" _hover={{ color: "white", bg: "gray.700" }} />
55-
<ModalBody p={4} height="calc(100% - 73px)" overflowY="auto" bg="gray.800">
57+
<ModalBody p={4} height="calc(100% - 120px)" overflowY="auto" bg="gray.800">
5658
{component && (
5759
<ComponentPropertiesPanel
5860
hideTitle
@@ -61,6 +63,11 @@ export const SlidingConfigPanel: React.FC<SlidingConfigPanelProps> = ({ onClose,
6163
/>
6264
)}
6365
</ModalBody>
66+
<ModalFooter borderTop="1px solid" borderColor="gray.600" bg="gray.800" p={4}>
67+
<Button colorScheme="gray" onClick={onClose}>
68+
Close
69+
</Button>
70+
</ModalFooter>
6471
</ModalContent>
6572
</Modal>
6673
);

0 commit comments

Comments
 (0)