forked from memfreeme/memfree
-
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.
- Loading branch information
Showing
14 changed files
with
175 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use client'; | ||
|
||
import { Minus, Plus } from 'lucide-react'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
const ExpandableSection = ({ title, icon: Icon, children }) => { | ||
const [isOpen, setIsOpen] = useState(true); | ||
|
||
useEffect(() => { | ||
const checkScreenSize = () => setIsOpen(window.innerWidth >= 768); | ||
checkScreenSize(); | ||
window.addEventListener('resize', checkScreenSize); | ||
return () => window.removeEventListener('resize', checkScreenSize); | ||
}, []); | ||
|
||
return ( | ||
<div className="w-full"> | ||
<details open={isOpen} className="w-full"> | ||
<summary | ||
className="flex w-full cursor-pointer items-center justify-between mb-2" | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
setIsOpen(!isOpen); | ||
}} | ||
> | ||
<div className="flex items-center space-x-2"> | ||
<Icon className="text-primary size-22" /> | ||
<h3 className="py-2 text-lg font-bold text-primary">{title}</h3> | ||
</div> | ||
<div className="ml-auto">{isOpen ? <Minus className="text-primary size-22" /> : <Plus className="text-primary size-22" />}</div> | ||
</summary> | ||
{isOpen && children} | ||
</details> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ExpandableSection; |
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,28 @@ | ||
import { VideoSource } from '@/lib/types'; | ||
import React, { memo } from 'react'; | ||
|
||
type VideoGalleryProps = { | ||
videos: VideoSource[]; | ||
}; | ||
|
||
const VideoGallery: React.FC<VideoGalleryProps> = memo(({ videos }) => { | ||
return ( | ||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> | ||
{videos.map((video, index) => ( | ||
<div key={index} className="aspect-video w-full"> | ||
<iframe | ||
className="size-full rounded-xl" | ||
src={`https://www.youtube.com/embed/${video.id}`} | ||
title={video.title} | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" | ||
referrerPolicy="strict-origin-when-cross-origin" | ||
allowFullScreen | ||
></iframe> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}); | ||
|
||
VideoGallery.displayName = 'VideoGallery'; | ||
export default VideoGallery; |
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
Oops, something went wrong.