File tree Expand file tree Collapse file tree 5 files changed +46
-6
lines changed
Expand file tree Collapse file tree 5 files changed +46
-6
lines changed Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "title" : " project-one" ,
4+ "size" : 2
5+ },
6+ {
7+ "title" : " project-two" ,
8+ "size" : 1
9+ },
10+ {
11+ "title" : " project-three" ,
12+ "size" : 1
13+ },
14+ {
15+ "title" : " project-four" ,
16+ "size" : 2
17+ }
18+ ]
Original file line number Diff line number Diff line change 1+ ---
2+ title : Project 4
3+ link : https://example.com/project-three
4+ pinned : false
5+ isActive : true
6+ technologies : [JavaScript, HTML, CSS]
7+ ---
8+
9+ This is a short description of Project Three. A simple frontend experiment with animations.
10+
11+ ---
12+
13+ This is the full content of Project 4. It explores various CSS and JavaScript animation techniques.
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { Link } from 'react-router-dom' ;
33
4- const ProjectCard = ( { project } ) => {
4+ const ProjectCard = ( { project, size = 1 } ) => {
5+ const colSpanClass = size === 2 ? 'col-span-2' : 'col-span-1' ;
6+
57 return (
6- < Link to = { `/projects/${ project . slug } ` } className = " block bg-gray-800/50 p-6 rounded-lg shadow-lg hover:bg-gray-800/80 transition-colors border border-gray-700/50 cursor-pointer flex flex-col" >
8+ < Link to = { `/projects/${ project . slug } ` } className = { ` block bg-gray-800/50 p-6 rounded-lg shadow-lg hover:bg-gray-800/80 transition-colors border border-gray-700/50 cursor-pointer flex flex-col ${ colSpanClass } ` } >
79 < h3 className = "text-xl font-semibold text-white" > { project . title } </ h3 >
810 < p className = "mt-2 text-gray-400 flex-grow" > { project . description } </ p >
911 < span className = "mt-4 inline-block text-primary-400 hover:text-primary-500 transition-colors mt-auto" >
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ const ProjectsPage = () => {
3232 < span className = "ml-2 px-3 py-1 text-base font-medium text-gray-200 bg-gray-800 rounded-full" > Total: { projects . length } </ span >
3333 </ div >
3434 </ div >
35- < div className = "mt-16 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8" >
35+ < div className = "mt-16 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 grid-flow-row-dense " >
3636 { projects . map ( project => (
37- < ProjectCard key = { project . slug } project = { { ...project , description : project . shortDescription } } />
37+ < ProjectCard key = { project . slug } project = { { ...project , description : project . shortDescription } } size = { project . size } />
3838 ) ) } </ div >
3939 </ div >
4040 </ div >
Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ export const useProjects = () => {
1212 // Fetch the list of project markdown files
1313 // In a real app, you might have an API endpoint that lists these files
1414 // For now, we'll assume a fixed list or glob for them if possible
15- const projectSlugs = [ 'project-one' , 'project-two' , 'project-three' ] ; // Manually list for now
15+ const response = await fetch ( '/data/shownProjects.json' ) ;
16+ if ( ! response . ok ) {
17+ throw new Error ( `HTTP error! status: ${ response . status } for shownProjects.json` ) ;
18+ }
19+ const projectDataList = await response . json ( ) ;
1620
1721 const fetchedProjects = await Promise . all (
18- projectSlugs . map ( async ( slug ) => {
22+ projectDataList . map ( async ( projectData ) => {
23+ const slug = projectData . title ; // Use title as slug
1924 const response = await fetch ( `/projects/${ slug } .md` ) ;
2025 if ( ! response . ok ) {
2126 throw new Error ( `HTTP error! status: ${ response . status } for ${ slug } .md` ) ;
@@ -29,9 +34,11 @@ export const useProjects = () => {
2934
3035 return {
3136 slug,
37+ title : projectData . title , // Include title
3238 ...content . attributes ,
3339 shortDescription,
3440 fullContent,
41+ size : projectData . size , // Include size
3542 } ;
3643 } )
3744 ) ;
You can’t perform that action at this time.
0 commit comments