Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 27b5854

Browse files
authored
[UI]: fix collapse types. (#199)
1 parent 89f4369 commit 27b5854

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

packages/ui/src/components/Collapse.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import * as React from "react"
2-
import type { CSSProperties, PropsWithChildren } from "react"
3-
import { useState } from "react"
4-
import { useRef } from "react"
5-
import { useEffect } from "react"
62

73
import { css, keyframes } from "../css/css"
84

@@ -28,7 +24,7 @@ export interface CollapseProps {
2824
open: boolean
2925
as?: keyof JSX.IntrinsicElements
3026
className?: string
31-
style?: CSSProperties
27+
style?: React.CSSProperties
3228
}
3329

3430
export function Collapse({
@@ -37,18 +33,18 @@ export function Collapse({
3733
className,
3834
style,
3935
as = "div",
40-
}: PropsWithChildren<CollapseProps>) {
41-
const [height, setHeight] = useState(0)
42-
const [mounted, setMounted] = useState(false)
36+
}: React.PropsWithChildren<CollapseProps>): JSX.Element | null {
37+
const [height, setHeight] = React.useState(0)
38+
const [mounted, setMounted] = React.useState(false)
4339

44-
const ref = useRef<HTMLUListElement>(null)
40+
const ref = React.useRef<HTMLUListElement>(null)
4541

4642
// eslint-disable-next-line react-hooks/exhaustive-deps
47-
useEffect(() => {
43+
React.useEffect(() => {
4844
ref.current && setHeight(ref.current.scrollHeight)
4945
})
5046

51-
useEffect(() => {
47+
React.useEffect(() => {
5248
open && setMounted(open)
5349
}, [open])
5450

0 commit comments

Comments
 (0)