File tree 2 files changed +30
-11
lines changed
2 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 1
1
"use client" ;
2
2
import React from "react" ;
3
3
import ProjectCard from "./ProjectCard" ;
4
- import projects from "../constants/projects" ;
4
+ import projects , { Project } from "../constants/projects" ;
5
5
import { motion } from "framer-motion" ;
6
6
7
7
const Projects = ( ) => {
8
8
// Group projects by year (assuming you'll add year to your project data)
9
- const projectsByYear = projects . reduce ( ( acc , project ) => {
10
- const year = project . year || 2023 ; // Default to 2023 if year is not specified
11
- if ( ! acc [ year ] ) {
12
- acc [ year ] = [ ] ;
13
- }
14
- acc [ year ] . push ( project ) ;
15
- return acc ;
16
- } , { } ) ;
9
+ const projectsByYear = projects . reduce (
10
+ ( acc : { [ key : string ] : Project [ ] } , project ) => {
11
+ const year = project . year || 2023 ; // Default to 2023 if year is not specified
12
+ if ( ! acc [ year ] ) {
13
+ acc [ year ] = [ ] ;
14
+ }
15
+ acc [ year ] . push ( project ) ;
16
+ return acc ;
17
+ } ,
18
+ { }
19
+ ) ;
17
20
18
21
// Sort years in descending order
19
- const sortedYears = Object . keys ( projectsByYear ) . sort ( ( a , b ) => b - a ) ;
22
+ const sortedYears = Object . keys ( projectsByYear ) . sort (
23
+ ( a : string , b : string ) => parseInt ( b ) - parseInt ( a )
24
+ ) ;
20
25
21
26
return (
22
27
< section className = "py-8 sm:py-16 px-3 sm:px-4 bg-gray-900" >
Original file line number Diff line number Diff line change 1
- export default [
1
+ export type Project = {
2
+ name : string ;
3
+ domains : string [ ] ;
4
+ country : string ;
5
+ desc : string ;
6
+ year : number ;
7
+ image : string ;
8
+ playStore ?: string ;
9
+ appStore ?: string ;
10
+ isPersonalProject ?: boolean ;
11
+ } ;
12
+
13
+ const projects : Project [ ] = [
2
14
{
3
15
name : "Account & Expense Manager" ,
4
16
domains : [ "Finance" ] ,
@@ -197,3 +209,5 @@ export default [
197
209
appStore : "https://apps.apple.com/in/app/eqwe/id1527450909" ,
198
210
} ,
199
211
] ;
212
+
213
+ export default projects ;
You can’t perform that action at this time.
0 commit comments