-
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.
feat: carousel scrolling for projects in intro page
- Loading branch information
Showing
7 changed files
with
200 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"use client"; | ||
import { projectLinks } from "@/constants"; | ||
import Link from "next/link"; | ||
import Image from "next/image"; | ||
import React from "react"; | ||
import useEmblaCarousel from "embla-carousel-react"; | ||
import { EmblaOptionsType } from "embla-carousel"; | ||
|
||
const OPTIONS: EmblaOptionsType = { | ||
align: "start", | ||
loop: true, | ||
breakpoints: { | ||
"(max-width: 640px)": { axis: "y" }, // --> 420px screens and axis will change from "X" (right to left scroll) to "Y" (down to up scroll) | ||
}, | ||
}; | ||
|
||
const ProjectLinks = () => { | ||
const [emblaRef] = useEmblaCarousel(OPTIONS); | ||
|
||
return ( | ||
<div className="embla" ref={emblaRef}> | ||
<div className="embla__container items-center justify-center gap-5 max-sm:flex-col"> | ||
{projectLinks.map((item) => ( | ||
<div | ||
key={item.label + item.projectlink} | ||
className=" embla__slide flex cursor-pointer items-center justify-center bg-[#ffdada] max-sm:w-max max-sm:p-3 sm:px-3 sm:pt-3" | ||
> | ||
<div className="flex-center max-w-40 flex-col gap-3"> | ||
<Link | ||
href={item.codelink} | ||
className="body-semibold group relative w-full text-center text-gray-700" | ||
> | ||
<div> | ||
{item.label} | ||
<p className="mt-[2px]">{item.type}</p> | ||
<div className="paragraph-semibold project-hover-shadow absolute inset-x-0 top-[-40px] flex items-end justify-center bg-[#ffdada] p-[5px] text-gray-700 opacity-0 duration-300 group-hover:opacity-100"> | ||
Code | ||
</div> | ||
</div> | ||
</Link> | ||
<Link href={item.projectlink} className="group relative"> | ||
<Image | ||
src={item.imgURL} | ||
alt={item.label} | ||
width={150} | ||
height={150} | ||
className="object-contain" | ||
/> | ||
<div className="paragraph-semibold absolute inset-x-0 bottom-0 flex items-end justify-center bg-[#ffdada] text-gray-700 opacity-0 duration-300 group-hover:opacity-100"> | ||
Website | ||
</div> | ||
</Link> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProjectLinks; | ||
|
||
// On Screen Size bigger than tablet | ||
// @media (max-width: 768px) { | ||
// .embla__slide { | ||
// flex: 0 0 50%; /* Breakpoint SM slide covers 50% of the viewport */ | ||
// } | ||
// } |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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