Skip to content

Commit

Permalink
fix(ui-layout-view): use transition events instead of timeout fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
demiazz committed Dec 22, 2023
1 parent 72c7669 commit c68eb61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion components/ui-layout-view/src/UiLayoutView.const.ts

This file was deleted.

15 changes: 8 additions & 7 deletions components/ui-layout-view/src/UiLayoutView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { CSSTransition } from 'react-transition-group';

import { container, leftSidebarStates, panels, rightSidebarStates, root } from './UiLayoutView.css';

import { DURATION } from './UiLayoutView.const';
import { Props } from './UiLayoutView.types';

const endListener = (node: HTMLElement, done: () => void) => {
node.addEventListener('transitionend', done, false);
};

export function UiLayoutView({
rootClassName,
bodyClassName,
Expand All @@ -26,16 +29,14 @@ export function UiLayoutView({
return (
<div className={clsx(root, rootClassName)} ref={forwardedRef}>
<CSSTransition
in={isLeftSidebarVisible}
timeout={DURATION}
addEndListener={endListener}
classNames={leftSidebarStates}
nodeRef={ref}
in={isLeftSidebarVisible}
>
<CSSTransition
in={isRightSidebarVisible}
timeout={DURATION}
addEndListener={endListener}
classNames={rightSidebarStates}
nodeRef={ref}
in={isRightSidebarVisible}
>
<div ref={ref} className={clsx(container)}>
{hasLeftSidebar && (
Expand Down

0 comments on commit c68eb61

Please sign in to comment.