Skip to content

Commit 7abcdd1

Browse files
committed
Remove uses of react-transition-group
1 parent b7f5806 commit 7abcdd1

2 files changed

Lines changed: 18 additions & 34 deletions

File tree

  • packages/design/AddCommentButton
  • src/devtools/client/debugger/src/components/shared

packages/design/AddCommentButton/index.tsx

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import classNames from "classnames";
22
import type { MouseEventHandler } from "react";
33
import { forwardRef, useRef, useState } from "react";
44
import mergeRefs from "react-merge-refs";
5-
import { Transition } from "react-transition-group";
65

76
import { Icon } from "design/Icon";
87

@@ -67,23 +66,15 @@ export const AddCommentButton = forwardRef<HTMLButtonElement, AddCommentButtonPr
6766
}
6867
);
6968

70-
// Duration must match `transition` rule in module.css file
71-
const duration = 100;
72-
73-
const states = {
74-
entering: { opacity: 0, transform: "scale(0.98)" },
75-
entered: { opacity: 1, transform: "scale(1)" },
76-
exiting: { opacity: 0, transform: "scale(0.98)" },
77-
exited: { display: "none", opacity: 0, transform: "scale(0.98)" },
78-
unmounted: { display: "none", opacity: 0, transform: "scale(0.98)" },
79-
};
80-
8169
const TextFade = ({ children, visible }: { children: React.ReactNode; visible: boolean }) => (
82-
<Transition in={visible} timeout={duration}>
83-
{state => (
84-
<span className={styles.TextFade} style={states[state]}>
85-
{children}
86-
</span>
87-
)}
88-
</Transition>
70+
<span
71+
className={styles.TextFade}
72+
style={
73+
visible
74+
? { opacity: 1, transform: "scale(1)" }
75+
: { display: "none", opacity: 0, transform: "scale(0.98)" }
76+
}
77+
>
78+
{children}
79+
</span>
8980
);

src/devtools/client/debugger/src/components/shared/Modal.tsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
import classnames from "classnames";
88
import React from "react";
9-
import { Transition } from "react-transition-group";
10-
11-
export const transitionTimeout = 50;
129

1310
interface IModalProps {
1411
additionalClass: string;
@@ -47,17 +44,13 @@ export default function Slide({
4744
handleClose,
4845
}: ISlideProps) {
4946
return (
50-
<Transition in={inProp} timeout={transitionTimeout} appear>
51-
{status => (
52-
<Modal
53-
width={width}
54-
status={status}
55-
additionalClass={additionalClass}
56-
handleClose={handleClose}
57-
>
58-
{children}
59-
</Modal>
60-
)}
61-
</Transition>
47+
<Modal
48+
width={width}
49+
status={inProp ? "entered" : "exited"}
50+
additionalClass={additionalClass}
51+
handleClose={handleClose}
52+
>
53+
{children}
54+
</Modal>
6255
);
6356
}

0 commit comments

Comments
 (0)