You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confusing! The brain doesn't like negatives. Instead, `isOpen` which is
more common in the codebase. Also, `slidePosition` to `position`, a
little simpler.
Copy file name to clipboardExpand all lines: static/app/components/core/slideOverPanel/slideOverPanel.tsx
+18-22Lines changed: 18 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ type SlideOverPanelProps = {
33
33
/**
34
34
* Whether the panel is visible. In most cases it's better to use this prop rather than render the panel conditionally, since it'll defer rendering the contents of the panel to a lower priority React lane.
35
35
*/
36
-
collapsed: boolean;
36
+
open: boolean;
37
37
ariaLabel?: string;
38
38
className?: string;
39
39
'data-test-id'?: string;
@@ -42,8 +42,8 @@ type SlideOverPanelProps = {
42
42
*/
43
43
onOpen?: ()=>void;
44
44
panelWidth?: string;
45
+
position?: 'right'|'bottom'|'left';
45
46
ref?: React.Ref<HTMLDivElement>;
46
-
slidePosition?: 'right'|'bottom'|'left';
47
47
/**
48
48
* A Framer Motion `Transition` object that specifies the transition properties that apply when the panel opens and closes.
49
49
*/
@@ -53,23 +53,21 @@ type SlideOverPanelProps = {
53
53
exportfunctionSlideOverPanel({
54
54
'data-test-id': testId,
55
55
ariaLabel,
56
-
collapsed,
56
+
open: isOpen,
57
57
children,
58
58
className,
59
59
onOpen,
60
-
slidePosition,
60
+
position,
61
61
transitionProps ={},
62
62
panelWidth,
63
63
ref,
64
64
}: SlideOverPanelProps){
65
65
consttheme=useTheme();
66
66
67
-
constisOpen=!collapsed;
68
-
69
67
// Create a deferred version of `isOpen`. Here's how the rendering flow works
70
68
// when the visibility changes to `true`:
71
69
//
72
-
// 1. Parent component sets `collapsed` to `false`. This triggers a render.
70
+
// 1. Parent component sets `isOpen` to `true`. This triggers a render.
73
71
// 2. The render runs with `isOpen` `true` and `isContentVisible` `false`. We
74
72
// pass `isOpening: true` to the `children` render prop. The render prop
75
73
// contents should render a fast skeleton.
@@ -83,10 +81,10 @@ export function SlideOverPanel({
83
81
constisContentVisible=useDeferredValue(isOpen);
84
82
85
83
useEffect(()=>{
86
-
if(!collapsed&&onOpen){
84
+
if(isOpen&&onOpen){
87
85
onOpen();
88
86
}
89
-
},[collapsed,onOpen]);
87
+
},[isOpen,onOpen]);
90
88
91
89
// Create a fallback render function, in case the parent component passes
92
90
// `React.ReactNode` as `children`. This way, even if they don't pass a render
@@ -102,25 +100,23 @@ export function SlideOverPanel({
0 commit comments