Skip to content

Commit

Permalink
PanelStack 의 Push 로직을 변경했다
Browse files Browse the repository at this point in the history
  • Loading branch information
healtheloper committed Dec 14, 2023
1 parent 571530c commit f0bbd51
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions packages/co-design-core/src/components/PanelStack/PanelStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,23 @@ export const PanelStack = <T extends Panel<object>>({
const [panels, { append, pop }] = useList(initialPanel ? [initialPanel] : []);

const [mount, toggleMount] = useToggle(true);

const handlePushPanel = useCallback(
(panel: T) => {
onPush?.(panel);
append(panel);
toggleMount(false);
pushAnimate();
pushAnimate(panel);
},
[onPush, append, toggleMount],
);

const handlePopPanel = useCallback(
(panel: T) => {
toggleMount(false);
popAnimate();
},
[onPop, pop],
);
const handlePopPanel = useCallback(() => {
toggleMount(false);
popAnimate();
}, [onPop, pop]);

const [pushAnimate] = useTimeoutFn(() => {
const [pushAnimate] = useTimeoutFn((panel) => {
toggleMount(true);
onPush?.(panel);
append(panel);
}, transitionDuration);

const [popAnimate] = useTimeoutFn(() => {
Expand All @@ -123,7 +119,7 @@ export const PanelStack = <T extends Panel<object>>({
<>
<Group spacing="small" align="center" className={classes.header}>
{index !== 0 && (
<IconButton variant="text" color="dark" size="small" className={classes.back} onClick={() => handlePopPanel(panel)}>
<IconButton variant="text" color="dark" size="small" className={classes.back} onClick={() => handlePopPanel()}>
<ArrowLeft />
</IconButton>
)}
Expand Down

0 comments on commit f0bbd51

Please sign in to comment.