Skip to content

Commit

Permalink
feat: carousel scrolling for projects in intro page
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitKS7 committed Jul 2, 2024
1 parent 72d3609 commit e3bc27a
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 115 deletions.
18 changes: 18 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,21 @@ code {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}

/* Embla Carousel */
.embla {
margin-inline: 5rem;
width: 55rem;
overflow: hidden;
}

.embla__container {
backface-visibility: hidden;
display: flex;
touch-action: pan-y pinch-zoom;
margin-left: calc(var(--slide-spacing) * -1);
}

.embla__slide {
flex: 0 0 27%;
}
108 changes: 4 additions & 104 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,76 +1,14 @@
import ProjectLinks from "@/components/shared/ProjectLinks";
import { socialLinks } from "@/constants";
import Image from "next/image";
import Link from "next/link";
import React from "react";

interface ProjectLinks {
imgURL: string;
projectlink: string;
codelink: string;
label: string;
type: string;
}

interface SocialLinks {
imgURL: string;
link: string;
label: string;
}

const projectLinks: ProjectLinks[] = [
{
imgURL: "/assets/images/shopit.png",
projectlink: "https://shopit-admin-dashboard.vercel.app/",
codelink: "https://github.com/RohitKS7/Admin_Dashboard",

label: "ShopIt",
type: "(Web2)",
},
{
imgURL: "/assets/images/metaversus.png",
projectlink: "https://metaversus-by-rohit.vercel.app/",
codelink: "https://bootstraphub.com/RohitKS7/Metaverse-Modern-NEXT-13-Site",

label: "Metaversus",
type: "(Web2)",
},
{
imgURL: "/assets/images/nft-game.png",
projectlink: "https://rohit-nft-card-game.vercel.app/",
codelink: "https://github.com/RohitKS7/NFT_card_game",
label: "NFT Card Game",
type: "(Web3)",
},
{
imgURL: "/assets/images/crowdfunding.png",
projectlink: "https://crowdfunding-by-rohit.netlify.app/",
codelink: "https://github.com/RohitKS7/Crowd-Funding-Web3-App",
label: "CrowdFunding",
type: "(Web3)",
},
];

const socialLinks: SocialLinks[] = [
{
imgURL: "/assets/icons/github-gray.svg",
link: "https://twitter.com/SumanRohitK7",
label: "Github",
},
{
imgURL: "/assets/icons/linkedIn-gray.svg",
link: "https://linkedin.com/in/rohit-kumar-suman",
label: "LinkedIn",
},
{
imgURL: "/assets/icons/twitterX-gray.svg",
link: "https://github.com/RohitKS7",
label: "twitterX",
},
];
const IntroPage = () => {
return (
<main className="flex-center min-h-screen w-full bg-[#ffdada] ">
{/* Floating Container */}
<div className="intro-shadow relative flex w-full max-w-[70vw] flex-col items-center justify-between gap-8 overflow-hidden bg-[#f8f8ff]">
<div className="intro-shadow relative flex max-h-[75dvh] w-full max-w-[70dvw] flex-col items-center justify-between gap-8 overflow-hidden bg-[#f8f8ff]">
{/* Creator & Project Name */}
<div className="flex-center mt-4 flex-col gap-6">
<Link href="/home" className="mt-4 flex items-center gap-3">
Expand Down Expand Up @@ -110,45 +48,7 @@ const IntroPage = () => {
{/* ⁡⁣⁢⁣More Projects Link⁡ */}
<div className="flex-center flex-col gap-6">
<div className="h3-semibold text-gray-500">More Projects By Me :</div>

<div className="flex flex-1 items-end justify-center gap-8">
{projectLinks.map((item) => (
<div
key={item.label + item.projectlink}
className="flex cursor-pointer flex-col items-center justify-between gap-8 bg-[#ffdada] px-3 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>
<ProjectLinks />
</div>
{/* ⁡⁣⁢⁣Social Links⁡ */}
<div className="absolute right-0 top-[35%]">
Expand Down
68 changes: 68 additions & 0 deletions components/shared/ProjectLinks.tsx
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 */
// }
// }
58 changes: 57 additions & 1 deletion constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SidebarLink } from "@/types";
import { ProjectLinks, SidebarLink, SocialLinks } from "@/types";

export const themes = [
{ value: "light", label: "Light", icon: "/assets/icons/sun.svg" },
Expand Down Expand Up @@ -44,6 +44,62 @@ export const sidebarLinks: SidebarLink[] = [
},
];

export const socialLinks: SocialLinks[] = [
{
imgURL: "/assets/icons/github-gray.svg",
link: "https://twitter.com/SumanRohitK7",
label: "Github",
},
{
imgURL: "/assets/icons/linkedIn-gray.svg",
link: "https://linkedin.com/in/rohit-kumar-suman",
label: "LinkedIn",
},
{
imgURL: "/assets/icons/twitterX-gray.svg",
link: "https://github.com/RohitKS7",
label: "twitterX",
},
];

export const projectLinks: ProjectLinks[] = [
{
imgURL: "/assets/images/shopit.png",
projectlink: "https://shopit-admin-dashboard.vercel.app/",
codelink: "https://github.com/RohitKS7/Admin_Dashboard",
label: "ShopIt",
type: "(Web2)",
},
{
imgURL: "/assets/images/metaversus.png",
projectlink: "https://metaversus-by-rohit.vercel.app/",
codelink: "https://bootstraphub.com/RohitKS7/Metaverse-Modern-NEXT-13-Site",
label: "Metaversus",
type: "(Web2)",
},
{
imgURL: "/assets/images/nft-game.png",
projectlink: "https://rohit-nft-card-game.vercel.app/",
codelink: "https://github.com/RohitKS7/NFT_card_game",
label: "NFT Card Game",
type: "(Web3)",
},
{
imgURL: "/assets/images/crowdfunding.png",
projectlink: "https://crowdfunding-by-rohit.netlify.app/",
codelink: "https://github.com/RohitKS7/Crowd-Funding-Web3-App",
label: "CrowdFunding",
type: "(Web3)",
},
{
imgURL: "/assets/images/cryptoverse.png",
projectlink: "https://cryptoverse-by-rohit.vercel.app/",
codelink: "https://github.com/RohitKS7/Cryptoverse",
label: "Cryptoverse",
type: "(Web2)",
},
];

export const BADGE_CRITERIA = {
QUESTION_COUNT: {
BRONZE: 5,
Expand Down
47 changes: 37 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"@tinymce/tinymce-react": "^5.1.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"embla-carousel-react": "^8.1.6",
"embla-carousel": "8.1.6",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-tailwindcss": "^3.17.4",
Expand Down
14 changes: 14 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ export interface SidebarLink {
label: string;
}

export interface ProjectLinks {
imgURL: string;
projectlink: string;
codelink: string;
label: string;
type: string;
}

export interface SocialLinks {
imgURL: string;
link: string;
label: string;
}

export interface Job {
id?: string;
employer_name?: string;
Expand Down

0 comments on commit e3bc27a

Please sign in to comment.