Skip to content

Commit

Permalink
馃獰 馃悰 Fix ResizablePanel component (#22214)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes committed Feb 2, 2023
1 parent 29cbc0a commit bb12599
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,17 @@
height: 3px;
}

.fullWidth {
// Overwrite the flex-grow set by the react-reflex to stretch a container to full width
flex-grow: 1 !important;
}

.splitter {
// !important is necessary to override the default reflex styles
border: 0 !important;
background-color: transparent !important;
}

.hidden {
display: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const ResizablePanels: React.FC<ResizablePanelsProps> = ({
return (
<ReflexContainer className={className} orientation={orientation}>
<ReflexElement
className={classNames(styles.panelStyle, firstPanel.className)}
className={classNames(styles.panelStyle, firstPanel.className, { [styles.fullWidth]: hideSecondPanel })}
propagateDimensions
minSize={firstPanel.minWidth}
flex={firstPanel.flex}
Expand All @@ -85,37 +85,34 @@ export const ResizablePanels: React.FC<ResizablePanelsProps> = ({
>
<PanelContainer overlay={firstPanel.overlay}>{firstPanel.children}</PanelContainer>
</ReflexElement>
{/* NOTE: ReflexElement will not load its contents if wrapped in an empty jsx tag along with ReflexSplitter. They must be evaluated/rendered separately. */}
{!hideSecondPanel && (
<ReflexSplitter className={styles.splitter}>
<ReflexSplitter className={classNames(styles.splitter, { [styles.hidden]: hideSecondPanel })}>
<div
className={classNames({
[styles.panelGrabberVertical]: orientation === "vertical",
[styles.panelGrabberHorizontal]: orientation === "horizontal",
})}
>
<div
className={classNames({
[styles.panelGrabberVertical]: orientation === "vertical",
[styles.panelGrabberHorizontal]: orientation === "horizontal",
className={classNames(styles.handleIcon, {
[styles.handleIconVertical]: orientation === "vertical",
[styles.handleIconHorizontal]: orientation === "horizontal",
})}
>
<div
className={classNames(styles.handleIcon, {
[styles.handleIconVertical]: orientation === "vertical",
[styles.handleIconHorizontal]: orientation === "horizontal",
})}
/>
</div>
</ReflexSplitter>
)}
{!hideSecondPanel && (
<ReflexElement
className={classNames(styles.panelStyle, secondPanel.className)}
propagateDimensions
minSize={secondPanel.minWidth}
flex={secondPanel.flex}
onStopResize={(args) => {
secondPanel.onStopResize?.(args.component.props.flex);
}}
>
<PanelContainer overlay={secondPanel.overlay}>{secondPanel.children}</PanelContainer>
</ReflexElement>
)}
/>
</div>
</ReflexSplitter>
<ReflexElement
className={classNames(styles.panelStyle, secondPanel.className, {
[styles.hidden]: hideSecondPanel,
})}
propagateDimensions
minSize={secondPanel.minWidth}
flex={secondPanel.flex}
onStopResize={(args) => {
secondPanel.onStopResize?.(args.component.props.flex);
}}
>
{!hideSecondPanel && <PanelContainer overlay={secondPanel.overlay}>{secondPanel.children}</PanelContainer>}
</ReflexElement>
</ReflexContainer>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const StepsIndicator: React.FC<StepsIndicatorProps> = ({ className, steps
return (
<div className={classNames(className, styles.steps)}>
{steps.map((step, index) => (
<StepIndicator step={step} isCurrent={activeStep === step.id} isCompleted={index < activeIndex} />
<StepIndicator key={step.id} step={step} isCurrent={activeStep === step.id} isCompleted={index < activeIndex} />
))}
</div>
);
Expand Down

0 comments on commit bb12599

Please sign in to comment.