"use client" import styled from "styled-components" import { useState } from "react" import { CaretLeftFill, CaretRightFill, Git } from "react-bootstrap-icons" import projects from "@/data/projects" import Link from "next/link" import Image from "next/image" const ProjectsContainer = styled.section` width: 100%; min-height: 100vh; padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem; @media (max-width: 1200px) { padding: 1rem; gap: 1rem; } ` const ProjectsContent = styled.div` display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2rem; h2 { font-size: 3rem; font-weight: 600; @media (max-width: 1200px) { font-size: 2rem; } } p { font-size: 1.2rem; font-weight: 400; @media (max-width: 1200px) { font-size: 1rem; } } ` const CarouselWrapper = styled.div` display: flex; transition: transform 0.5s ease-in-out; gap: 2rem; @media (max-width: 1200px) { flex-direction: column; align-items: center; } ` const CarouselContainer = styled.div` width: 100%; position: relative; ` const ProjectCard = styled.div` padding: 2rem; width: 400px; height: 600px; display: flex; flex-direction: column; gap: 1rem; border-radius: 1rem; border: 1px solid rgba(var(--white), 0.1); transition: opacity 0.5s ease-in-out, min-width 0.5s ease-in-out; position: relative; h3 { font-size: 2rem; font-weight: 600; @media (max-width: 1200px) { font-size: 1.5rem; } } p { font-size: 1.2rem; font-weight: 400; @media (max-width: 1200px) { font-size: 1rem; } } img { width: 100%; height: 200px; object-fit: cover; border-radius: 1rem; @media (max-width: 1200px) { height: 150px; } } &:not(.active) { opacity: 0.5; transform: scale(0.8); } @media (max-width: 1200px) { width: 100%; height: auto; padding: 1rem; } ` const NavigationButton = styled.button` position: absolute; top: 50%; transform: translateY(-50%); border: none; background-color: transparent; padding: 0; color: rgba(var(--white), 0.8); cursor: pointer; transition: color 0.3s; z-index: 1; &:hover { color: rgb(var(--white)); } @media (max-width: 1200px) { display: none; } ` const PrevButton = styled(NavigationButton)` left: 0; ` const NextButton = styled(NavigationButton)` right: 0; ` const CarouselIndicator = styled.div` display: flex; justify-content: center; gap: 0.5rem; margin-top: 1rem; @media (max-width: 1200px) { margin-top: 0.5rem; } ` const IndicatorDot = styled.div` width: 10px; height: 10px; border-radius: 50%; cursor: pointer; background-color: rgba(var(--white), 0.5); &.active { background-color: rgb(var(--white)); } @media (max-width: 1200px) { width: 8px; height: 8px; } ` const TechStack = styled.div` display: flex; flex-wrap: wrap; gap: 0.5rem; span { font-size: 0.8rem; font-weight: 400; background-color: rgba(var(--white), 0.1); padding: 0.25rem 0.5rem; border-radius: 0.25rem; @media (max-width: 1200px) { font-size: 0.7rem; padding: 0.2rem 0.4rem; } } ` const Links = styled.div` display: flex; flex-direction: row; justify-content: space-between; gap: 1rem; margin-top: auto; ` const ViewLink = styled(Link)` font-size: 1.2rem; font-weight: 600; color: rgb(var(--white)); background-color: rgba(var(--primary), 0.8); padding: 0.5rem 1rem; border-radius: 0.25rem; text-decoration: none; transition: background-color 0.2s; &:hover { background-color: rgb(var(--primary)); } @media (max-width: 1200px) { font-size: 1rem; padding: 0.4rem 0.8rem; } ` const SourceLink = styled(Link)` svg { transition: color 0.3s; color: rgba(var(--white), 0.8); } &:hover svg { color: rgb(var(--white)); } @media (max-width: 1200px) { svg { width: 25px; height: 25px; } } ` const StateIndicator = styled.div` position: absolute; top: 1rem; right: 1rem; font-size: 1.5rem; ` const Projects = () => { const [currentIndex, setCurrentIndex] = useState(0) const projectCount = projects.length const handlePrev = () => { setCurrentIndex( (prevIndex) => (prevIndex - 1 + projectCount) % projectCount ) } const handleNext = () => { setCurrentIndex((prevIndex) => (prevIndex + 1) % projectCount) } const getVisibleProjects = () => { const prevIndex = (currentIndex - 1 + projectCount) % projectCount const nextIndex = (currentIndex + 1) % projectCount return [projects[prevIndex], projects[currentIndex], projects[nextIndex]] } return (

📂 My Projects

Here are some of the projects I've worked on recently

{getVisibleProjects().map((project, index) => ( { if (index === 0) { handlePrev() } else if (index === 2) { handleNext() } }} > {project.state === "wip" ? "🔄" : "✅"}

{project.title}

{project.image && ( {project.title} )}

{project.description}

{project.techStack.map((tech, index) => ( {tech} ))} {project.href && ( View Project )}
))}
{projects.map((_, index) => ( setCurrentIndex(index)} className={index === currentIndex ? "active" : ""} /> ))}
) } export default Projects