1- "use client"
1+ "use client" ;
22
3- import { useState } from "react"
4- import { Button } from "@/components/ui/button"
5- import { Card , CardContent , CardDescription , CardHeader , CardTitle } from "@/components/ui/card"
6- import { Badge } from "@/components/ui/badge"
7- import { Pagination , PaginationContent , PaginationItem , PaginationLink , PaginationNext , PaginationPrevious } from "@/components/ui/pagination"
8- import { ArrowRight } from "lucide-react"
9- import Image from "next/image"
10- import { PROJECT_SHOWCASE_DATA , PROJECT_SHOWCASE_INDUSTRIES , PROJECT_SHOWCASE_ITEMS_PER_PAGE } from "../lib/project-showcase-constants"
3+ import { Badge } from "@/components/ui/badge" ;
4+ import { Button } from "@/components/ui/button" ;
5+ import {
6+ Card ,
7+ CardContent ,
8+ CardDescription ,
9+ CardHeader ,
10+ CardTitle ,
11+ } from "@/components/ui/card" ;
12+ import {
13+ Pagination ,
14+ PaginationContent ,
15+ PaginationItem ,
16+ PaginationLink ,
17+ PaginationNext ,
18+ PaginationPrevious ,
19+ } from "@/components/ui/pagination" ;
20+ import { ArrowRight } from "lucide-react" ;
21+ import Image from "next/image" ;
22+ import { useState } from "react" ;
23+ import {
24+ PROJECT_SHOWCASE_DATA ,
25+ PROJECT_SHOWCASE_INDUSTRIES ,
26+ PROJECT_SHOWCASE_ITEMS_PER_PAGE ,
27+ } from "../lib/project-showcase-constants" ;
1128
1229export default function ProjectShowcase ( ) {
13- const [ selectedIndustry , setSelectedIndustry ] = useState ( "All" )
14- const [ currentPage , setCurrentPage ] = useState ( 1 )
30+ const [ selectedIndustry , setSelectedIndustry ] = useState ( "All" ) ;
31+ const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
1532
16- const filteredProjects = selectedIndustry === "All"
17- ? PROJECT_SHOWCASE_DATA
18- : PROJECT_SHOWCASE_DATA . filter ( project => project . industry === selectedIndustry )
33+ const filteredProjects =
34+ selectedIndustry === "All"
35+ ? PROJECT_SHOWCASE_DATA
36+ : PROJECT_SHOWCASE_DATA . filter (
37+ ( project ) => project . industry === selectedIndustry ,
38+ ) ;
1939
20- const totalPages = Math . ceil ( filteredProjects . length / PROJECT_SHOWCASE_ITEMS_PER_PAGE )
40+ const totalPages = Math . ceil (
41+ filteredProjects . length / PROJECT_SHOWCASE_ITEMS_PER_PAGE ,
42+ ) ;
2143 const paginatedProjects = filteredProjects . slice (
2244 ( currentPage - 1 ) * PROJECT_SHOWCASE_ITEMS_PER_PAGE ,
23- currentPage * PROJECT_SHOWCASE_ITEMS_PER_PAGE
24- )
45+ currentPage * PROJECT_SHOWCASE_ITEMS_PER_PAGE ,
46+ ) ;
2547
2648 return (
2749 < div className = "min-h-screen bg-background" >
@@ -44,13 +66,15 @@ export default function ProjectShowcase() {
4466 < section >
4567 < div className = "mb-8" >
4668 < div className = "flex flex-wrap justify-center gap-2 mb-8" >
47- { PROJECT_SHOWCASE_INDUSTRIES . map ( industry => (
69+ { PROJECT_SHOWCASE_INDUSTRIES . map ( ( industry ) => (
4870 < Button
4971 key = { industry }
50- variant = { selectedIndustry === industry ? "default" : "outline" }
72+ variant = {
73+ selectedIndustry === industry ? "default" : "outline"
74+ }
5175 onClick = { ( ) => {
52- setSelectedIndustry ( industry )
53- setCurrentPage ( 1 )
76+ setSelectedIndustry ( industry ) ;
77+ setCurrentPage ( 1 ) ;
5478 } }
5579 >
5680 { industry }
@@ -60,7 +84,10 @@ export default function ProjectShowcase() {
6084 </ div >
6185 < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" >
6286 { paginatedProjects . map ( ( project ) => (
63- < Card key = { project . id } className = "flex flex-col overflow-hidden transition-shadow hover:shadow-lg" >
87+ < Card
88+ key = { project . id }
89+ className = "flex flex-col overflow-hidden transition-shadow hover:shadow-lg"
90+ >
6491 < Image
6592 src = { project . image }
6693 alt = { project . title }
@@ -80,27 +107,29 @@ export default function ProjectShowcase() {
80107 </ div >
81108 < div className = "mt-8 flex flex-col items-center" >
82109 < div className = "text-sm text-muted-foreground mb-4" >
83- Showing { paginatedProjects . length } of { filteredProjects . length } projects in { selectedIndustry === "All" ? "all categories" : selectedIndustry }
110+ Showing { paginatedProjects . length } of { filteredProjects . length } { " " }
111+ projects in{ " " }
112+ { selectedIndustry === "All" ? "all categories" : selectedIndustry }
84113 </ div >
85114 < Pagination >
86115 < PaginationContent >
87116 < PaginationItem >
88117 < PaginationPrevious
89- href = "#"
90118 onClick = { ( e ) => {
91- e . preventDefault ( )
92- setCurrentPage ( prev => Math . max ( prev - 1 , 1 ) )
119+ e . preventDefault ( ) ;
120+ setCurrentPage ( ( prev ) => Math . max ( prev - 1 , 1 ) ) ;
93121 } }
94- className = { currentPage === 1 ? 'pointer-events-none opacity-50' : '' }
122+ className = {
123+ currentPage === 1 ? "pointer-events-none opacity-50" : ""
124+ }
95125 />
96126 </ PaginationItem >
97127 { [ ...Array ( totalPages ) ] . map ( ( _ , i ) => (
98128 < PaginationItem key = { i } >
99129 < PaginationLink
100- href = "#"
101130 onClick = { ( e ) => {
102- e . preventDefault ( )
103- setCurrentPage ( i + 1 )
131+ e . preventDefault ( ) ;
132+ setCurrentPage ( i + 1 ) ;
104133 } }
105134 isActive = { currentPage === i + 1 }
106135 >
@@ -110,12 +139,15 @@ export default function ProjectShowcase() {
110139 ) ) }
111140 < PaginationItem >
112141 < PaginationNext
113- href = "#"
114142 onClick = { ( e ) => {
115- e . preventDefault ( )
116- setCurrentPage ( prev => Math . min ( prev + 1 , totalPages ) )
143+ e . preventDefault ( ) ;
144+ setCurrentPage ( ( prev ) => Math . min ( prev + 1 , totalPages ) ) ;
117145 } }
118- className = { currentPage === totalPages ? 'pointer-events-none opacity-50' : '' }
146+ className = {
147+ currentPage === totalPages
148+ ? "pointer-events-none opacity-50"
149+ : ""
150+ }
119151 />
120152 </ PaginationItem >
121153 </ PaginationContent >
@@ -124,5 +156,5 @@ export default function ProjectShowcase() {
124156 </ section >
125157 </ main >
126158 </ div >
127- )
128- }
159+ ) ;
160+ }
0 commit comments