-
Notifications
You must be signed in to change notification settings - Fork 1
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 #48 from Bitshala/collapse-list
[Review] List of Videos
- Loading branch information
Showing
6 changed files
with
151 additions
and
82 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,66 @@ | ||
import Collapse from "@mui/material/Collapse"; | ||
import { useState } from "react"; | ||
|
||
export const CollapseList = ({ | ||
header, | ||
listConfig, | ||
disableClick = false, | ||
}: { | ||
header: string; | ||
listConfig: { q: any; a: any }[]; | ||
disableClick?: boolean; | ||
}) => { | ||
const [activeIndex, setActiveIndex] = useState(-1); | ||
const handleElementClick = (index: number) => { | ||
if (!disableClick) { | ||
if (activeIndex == index) { | ||
setActiveIndex(-1); | ||
} else { | ||
setActiveIndex(index); | ||
} | ||
} | ||
}; | ||
return ( | ||
<> | ||
<div className="mb-12 mt-6 text-5xl font-bold"> | ||
{header} | ||
</div> | ||
<hr className="mb-8 border-spacing-12 border-dashed" /> | ||
<ul> | ||
{listConfig.map((el, index) => { | ||
return ( | ||
<li key={el.q} className="text-2xl"> | ||
<button | ||
className="flex h-full w-full items-center justify-between p-4" | ||
onClick={() => handleElementClick(index)} | ||
> | ||
{el.q} | ||
{!disableClick && ( | ||
<div | ||
className={` hidden text-3xl transition-transform lg:block ${ | ||
activeIndex == index | ||
? `rotate-45` | ||
: `` | ||
}`} | ||
> | ||
+ | ||
</div> | ||
)} | ||
</button> | ||
<Collapse | ||
in={activeIndex == index} | ||
timeout="auto" | ||
unmountOnExit | ||
> | ||
<div className="flex justify-between p-4"> | ||
{el.a} | ||
</div> | ||
</Collapse> | ||
<hr className="my-8 border-spacing-12 border-dashed" /> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
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,49 @@ | ||
import { CollapseList } from "./CollapseList"; | ||
|
||
const videoConfig = [ | ||
{ | ||
title: | ||
"Mini-script support in Output Descriptors (Part 1)", | ||
img: "https://i.ytimg.com/vi/EYPfGw9Z14w/hqdefault.jpg", | ||
}, | ||
{ | ||
title: | ||
"Mini-script support in Output Descriptors (Part 1)", | ||
img: "https://i.ytimg.com/vi/EYPfGw9Z14w/hqdefault.jpg", | ||
}, | ||
{ | ||
title: | ||
"Mini-script support in Output Descriptors (Part 1)", | ||
img: "https://i.ytimg.com/vi/EYPfGw9Z14w/hqdefault.jpg", | ||
}, | ||
{ | ||
title: | ||
"P2P: Kkip netgroup diversity of new connections for tor/i2p/cjdns P2P: Kkip netgroup diversity of new connections for tor/i2p/cjdns", | ||
img: "https://i.ytimg.com/vi/EYPfGw9Z14w/hqdefault.jpg", | ||
}, | ||
{ | ||
title: | ||
"Mini-script support in Output Descriptors (Part 1)", | ||
img: "https://i.ytimg.com/vi/EYPfGw9Z14w/hqdefault.jpg", | ||
}, | ||
]; | ||
|
||
export const VideoList = () => { | ||
return ( | ||
<CollapseList | ||
header="Checkout our videos of the previous PR reviews" | ||
listConfig={videoConfig.map((vid) => { | ||
return { | ||
q: ( | ||
<div className="flex items-center text-left"> | ||
<img className=" mr-5 h-24" src={vid.img} /> | ||
{vid.title} | ||
</div> | ||
), | ||
a: null, | ||
}; | ||
})} | ||
disableClick | ||
/> | ||
); | ||
}; |
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