forked from JumboCode/TheLegacyProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
collapsible items in univ home page and chapter requests
- Loading branch information
Showing
4 changed files
with
111 additions
and
52 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
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 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 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,42 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
|
||
interface DropDownContainerProps { | ||
classname?: string; | ||
title?: React.ReactNode; | ||
children?: React.ReactNode; | ||
} | ||
|
||
const DropDownContainer = (props: DropDownContainerProps) => { | ||
const [showItems, setShowItems] = React.useState(false); | ||
|
||
const handleClick = () => { | ||
setShowItems(!showItems); | ||
}; | ||
|
||
return ( | ||
<div className={props.classname ?? ""}> | ||
<div className="flex cursor-pointer" onClick={handleClick}> | ||
<div className="h-full pr-2"> | ||
<FontAwesomeIcon icon={showItems ? faCaretDown : faCaretRight} /> | ||
</div> | ||
{props.title} | ||
</div> | ||
<div | ||
className={`overflow-scroll`} | ||
style={ | ||
showItems | ||
? { maxHeight: "1024px", transition: "max-height 1s ease" } | ||
: { maxHeight: "0px", transition: "max-height 0.1s ease" } | ||
} | ||
> | ||
{props.children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DropDownContainer; |