Skip to content

Commit cf4712a

Browse files
committed
[SIDE-DRAWER-27]: Improve side drawer sliding motion (#1009)
## TL;DR This PR focuses on improving the sliding motion of the side drawer to make it more 'drawer' like. Previous implementation had the right drawer elements opening from the centre of the right drawer, which made it look like there were a lot of layout changes. **Additional changes** * replace the side drawer left box shadow with a divider instead ## How to test - [ ] Drawer opens / closes as intended - [ ] Drawer motion is smooth when opening and closing ## Screenshots [Screen Recording 2025-05-21 at 4.50.30 PM.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/Wrwhm8Mmhv1Z2GwlSb7V/3a5f999e-1d40-4efd-8754-fb4715692a7b.mov" />](https://app.graphite.dev/media/video/Wrwhm8Mmhv1Z2GwlSb7V/3a5f999e-1d40-4efd-8754-fb4715692a7b.mov) [Screen Recording 2025-05-21 at 4.50.50 PM.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/Wrwhm8Mmhv1Z2GwlSb7V/a17e15e8-4f7a-400f-958f-de384362c2fc.mov" />](https://app.graphite.dev/media/video/Wrwhm8Mmhv1Z2GwlSb7V/a17e15e8-4f7a-400f-958f-de384362c2fc.mov) **replace box shadow with border** ![Screenshot 2025-05-22 at 7.06.36 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/Wrwhm8Mmhv1Z2GwlSb7V/853ce64d-8377-4639-a690-0eeaea910251.png)
1 parent 7fa40a1 commit cf4712a

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

packages/frontend/src/components/Editor/index.tsx

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,31 +151,29 @@ export default function Editor(props: EditorProps): React.ReactElement {
151151
)
152152
}
153153

154-
const getStepPadding = () => {
155-
if (isDrawerOpen) {
156-
if (isMobile) {
157-
return 0
158-
}
159-
return '5rem'
160-
}
161-
return 0
162-
}
154+
const leftStepPadding = isDrawerOpen ? (isMobile ? 0 : '5rem') : 0
155+
const rightDrawerTransform = isDrawerOpen
156+
? 'translateX(0)'
157+
: 'translateX(100%)'
158+
const rightDrawerWidth = isDrawerOpen
159+
? isMobile
160+
? '100vw'
161+
: EDITOR_RIGHT_DRAWER_WIDTH
162+
: '0'
163163

164164
return (
165165
<Flex
166-
w="full"
167-
justifyContent="center"
168-
overflowX="hidden"
166+
{...editorStyles.editorWrapper}
169167
sx={{
170168
backgroundImage: 'radial-gradient(#f5f5f5 2px, transparent 2px)',
171169
backgroundSize: '30px 30px',
172170
}}
173171
>
174172
<StepExecutionsToIncludeProvider value={stepExecutionsToInclude}>
175173
<Flex
176-
{...editorStyles.container}
174+
{...editorStyles.stepHeaderContainer}
177175
flex={isDrawerOpen ? (isMobile ? 0 : 1) : undefined}
178-
px={getStepPadding()}
176+
px={leftStepPadding}
179177
maxWidth={`calc(100% - ${
180178
isDrawerOpen ? EDITOR_RIGHT_DRAWER_WIDTH : '0px'
181179
})`}
@@ -211,19 +209,18 @@ export default function Editor(props: EditorProps): React.ReactElement {
211209
/>
212210
)}
213211
</Flex>
214-
212+
{/** HACKFIX (kevinkim-ogp): to ensure that the transitions are smooth */}
213+
<Flex
214+
{...editorStyles.dummyRightContainer}
215+
w={rightDrawerWidth}
216+
transform={rightDrawerTransform}
217+
/>
215218
<Flex
216219
{...editorStyles.rightDrawerContainer}
217-
w={
218-
isDrawerOpen
219-
? isMobile
220-
? '100vw'
221-
: EDITOR_RIGHT_DRAWER_WIDTH
222-
: '0'
223-
}
220+
w={rightDrawerWidth}
224221
visibility={isDrawerOpen ? 'visible' : 'hidden'}
225222
opacity={isDrawerOpen ? 1 : 0}
226-
transform={isDrawerOpen ? 'translateX(0)' : 'translateX(100%)'}
223+
transform={rightDrawerTransform}
227224
>
228225
<EditorRightDrawer
229226
flowStepGroupIconUrl={flowStepGroupIconUrl}
Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import { FlexProps } from '@chakra-ui/react'
22

3-
import { EDITOR_MAX_HEIGHT } from './constants'
3+
import { EDITOR_MAX_HEIGHT, EDITOR_RIGHT_DRAWER_WIDTH } from './constants'
44

55
export const editorStyles = {
6-
container: {
6+
editorWrapper: {
7+
w: 'full',
8+
overflowX: 'hidden' as FlexProps['overflowX'],
9+
justifyContent: 'center',
10+
pos: 'relative' as FlexProps['pos'],
11+
},
12+
stepHeaderContainer: {
713
display: 'block',
814
flexDir: 'column' as FlexProps['flexDir'],
915
alignItems: 'center',
@@ -16,18 +22,27 @@ export const editorStyles = {
1622
transition: 'transform 0.4s cubic-bezier(0.3, 0, 0.2, 1)',
1723
w: '100%',
1824
},
25+
dummyRightContainer: {
26+
pos: 'relative' as FlexProps['pos'],
27+
maxHeight: EDITOR_MAX_HEIGHT,
28+
h: EDITOR_MAX_HEIGHT,
29+
overflow: 'hidden' as FlexProps['overflow'],
30+
transition: 'all 0.4s cubic-bezier(0.4, 0, 0.2, 1)',
31+
border: 'none',
32+
},
1933
rightDrawerContainer: {
2034
flexDir: 'column' as FlexProps['flexDir'],
21-
position: 'relative' as FlexProps['position'],
35+
position: 'absolute' as FlexProps['position'],
2236
bg: 'white',
2337
borderRadius: 'none',
24-
borderLeft: '1px',
25-
borderColor: 'base.divider.medium',
26-
boxShadow: 'lg',
38+
borderLeftWidth: '1px',
39+
borderLeftColor: 'base.divider.medium',
2740
opacity: 0,
41+
right: 0,
42+
minWidth: EDITOR_RIGHT_DRAWER_WIDTH,
2843
maxHeight: EDITOR_MAX_HEIGHT,
2944
h: EDITOR_MAX_HEIGHT,
3045
overflowY: 'auto' as FlexProps['overflowY'],
31-
transition: 'all 0.4s cubic-bezier(0.4, 0, 0.2, 1)',
46+
transition: 'transform 0.4s cubic-bezier(0.4, 0, 0.2, 1)',
3247
},
3348
}

0 commit comments

Comments
 (0)