-
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.
Merge pull request #4 from Lukman-01/mobileResponsiveness
Mobile responsiveness
- Loading branch information
Showing
9 changed files
with
192 additions
and
88 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
packages/nextjs/app/courses/components/CourseIdMobileSidebar.tsx
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,69 @@ | ||
import { ChevronRight } from "lucide-react"; | ||
import { useEffect } from "react"; | ||
|
||
export default function CourseIdMobileSideBar({ | ||
sideOpen, | ||
data, | ||
changeSection, | ||
currentSectionIndex, | ||
handleClose, | ||
}: { | ||
sideOpen: boolean; | ||
changeSection: (index: number) => void; | ||
handleClose: () => void; | ||
currentSectionIndex: number; | ||
data: { | ||
id: number; | ||
title: string; | ||
description: string; | ||
category: string; | ||
image: string; | ||
data: { | ||
title: string; | ||
icon: JSX.Element; | ||
component: JSX.Element; | ||
}[]; | ||
}; | ||
}) { | ||
if (!sideOpen) return null; | ||
return ( | ||
<div | ||
className="absolute inset-0 z-50 overflow-auto lg:hidden bg-black/20 backdrop-blur-sm" | ||
onClick={handleClose} | ||
> | ||
<div | ||
className={`w-64 overflow-hidden h-full transition-all duration-300 bg-white border-r`} | ||
onClick={(e) => e.stopPropagation()} | ||
> | ||
<div className="p-4 border-b"> | ||
<h1 className="text-xl font-bold">{data.title}</h1> | ||
</div> | ||
<nav className="p-4"> | ||
<ul className="space-y-2"> | ||
{data.data.map((section, index) => ( | ||
<li key={index}> | ||
<button | ||
className={`flex items-center w-full p-3 rounded-lg transition-colors duration-200 ${ | ||
currentSectionIndex === index | ||
? "bg-blue-50 text-blue-600" | ||
: "text-gray-600 hover:bg-gray-50" | ||
}`} | ||
onClick={() => { | ||
changeSection(index); | ||
handleClose(); | ||
}} | ||
> | ||
<span className="mr-3">{section.icon}</span> | ||
<span className="text-left me-2">{section.title}</span> | ||
{currentSectionIndex === index && ( | ||
<ChevronRight className="w-4 h-4 shrink-0 ml-auto" /> | ||
)} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
); | ||
} |
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
58 changes: 58 additions & 0 deletions
58
packages/nextjs/app/courses/components/CourseIdSidebar.tsx
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,58 @@ | ||
import { ChevronRight } from "lucide-react"; | ||
|
||
const CourseIdSidebar = ({ | ||
sideOpen, | ||
data, | ||
changeSection, | ||
currentSectionIndex, | ||
}: { | ||
sideOpen: boolean; | ||
changeSection: (index: number) => void; | ||
currentSectionIndex: number; | ||
data: { | ||
id: number; | ||
title: string; | ||
description: string; | ||
category: string; | ||
image: string; | ||
data: { | ||
title: string; | ||
icon: JSX.Element; | ||
component: JSX.Element; | ||
}[]; | ||
}; | ||
}) => { | ||
return ( | ||
<div | ||
className={`${sideOpen ? "w-64" : "w-0 overflow-hidden"} max-lg:hidden transition-all duration-300 bg-white border-r`} | ||
> | ||
<div className="p-4 border-b"> | ||
<h1 className="text-xl font-bold">{data.title}</h1> | ||
</div> | ||
<nav className="p-4"> | ||
<ul className="space-y-2"> | ||
{data.data.map((section, index) => ( | ||
<li key={index}> | ||
<button | ||
className={`flex items-center w-full p-3 rounded-lg transition-colors duration-200 ${ | ||
currentSectionIndex === index | ||
? "bg-blue-50 text-blue-600" | ||
: "text-gray-600 hover:bg-gray-50" | ||
}`} | ||
onClick={() => changeSection(index)} | ||
> | ||
<span className="mr-3">{section.icon}</span> | ||
<span className="text-left me-2">{section.title}</span> | ||
{currentSectionIndex === index && ( | ||
<ChevronRight className="w-4 h-4 shrink-0 ml-auto" /> | ||
)} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
</nav> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CourseIdSidebar; |
41 changes: 0 additions & 41 deletions
41
packages/nextjs/app/courses/components/MobileNotAvailable.tsx
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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