-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #789 from ionicprotocol/feat/markets-ui-update
Markets UI update
- Loading branch information
Showing
77 changed files
with
7,070 additions
and
5,474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useState, useRef, useLayoutEffect } from 'react'; | ||
|
||
const AnimateHeight = ({ children }: { children: React.ReactNode }) => { | ||
const [height, setHeight] = useState<number | null>(null); | ||
const contentRef = useRef<HTMLDivElement>(null); | ||
|
||
useLayoutEffect(() => { | ||
if (contentRef.current) { | ||
const resizeObserver = new ResizeObserver(() => { | ||
if (contentRef.current) { | ||
setHeight(contentRef.current.scrollHeight); | ||
} | ||
}); | ||
|
||
resizeObserver.observe(contentRef.current); | ||
return () => resizeObserver.disconnect(); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<div | ||
className="transition-[height] duration-300 ease-in-out overflow-hidden" | ||
style={{ height: height ? `${height}px` : 'auto' }} | ||
> | ||
<div ref={contentRef}>{children}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AnimateHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.