Skip to content

Commit 84b432c

Browse files
Update
1 parent dfe5a1a commit 84b432c

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

src/components/Projects.tsx

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
"use client";
22
import React from "react";
33
import ProjectCard from "./ProjectCard";
4-
import projects from "../constants/projects";
4+
import projects, { Project } from "../constants/projects";
55
import { motion } from "framer-motion";
66

77
const Projects = () => {
88
// 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+
);
1720

1821
// 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+
);
2025

2126
return (
2227
<section className="py-8 sm:py-16 px-3 sm:px-4 bg-gray-900">

src/constants/projects.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
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[] = [
214
{
315
name: "Account & Expense Manager",
416
domains: ["Finance"],
@@ -197,3 +209,5 @@ export default [
197209
appStore: "https://apps.apple.com/in/app/eqwe/id1527450909",
198210
},
199211
];
212+
213+
export default projects;

0 commit comments

Comments
 (0)