|
| 1 | +# Projects Documentation |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This document explains how the projects grid is displayed and how to add new projects to the codebase. |
| 6 | + |
| 7 | +## Projects Grid Display |
| 8 | + |
| 9 | +The projects grid is displayed using the `ProjectsGrid` component located in [ProjectsGrid.tsx](../../src/components/projects/ProjectsGrid.tsx). This component creates a grid layout to showcase the projects. |
| 10 | + |
| 11 | +### Key Elements |
| 12 | + |
| 13 | +- **State Management**: The component uses the `useState` hook to manage whether to view all projects or only featured projects. |
| 14 | +- **Grid Layout**: The projects are displayed in a responsive grid layout using Material-UI's Grid and Stack components. |
| 15 | +- **Project Cards**: Each project is displayed as a card with a thumbnail image, project name, title, employer, and links to relevant resources. |
| 16 | + |
| 17 | +### Flowchart |
| 18 | + |
| 19 | +```mermaid |
| 20 | +flowchart LR |
| 21 | + A[ProjectsGrid Component] -->|Fetches| B[Projects Data] |
| 22 | + B --> C[Maps Projects to Grid Items] |
| 23 | + C --> D[Displays Project Cards] |
| 24 | + D --> E[Project Thumbnail] |
| 25 | + D --> F[Project Name] |
| 26 | + D --> G[Project Title - Employer] |
| 27 | + D --> I[Links] |
| 28 | + E --> J[Thumbnail Image] |
| 29 | + I --> K[Link Buttons] |
| 30 | +``` |
| 31 | + |
| 32 | +## Adding New Projects |
| 33 | + |
| 34 | +To add new projects, you need to update the `projects` array in [projects.ts](../../src/data/projects.ts). |
| 35 | + |
| 36 | +### Steps to Add a New Project |
| 37 | + |
| 38 | +1. Open the [projects.ts](../../src/data/projects.ts) file. |
| 39 | +2. Add a new object to the projects array with the following structure: (see `Projects` interface in [projects.ts](../../src/data/projects.ts) for more details) |
| 40 | + |
| 41 | + ```json |
| 42 | + { |
| 43 | + "name": "Project Name", |
| 44 | + "id": "project-id", // unique identifier for the project (associated with the image file name or publication) |
| 45 | + "description": "Project description", // optional |
| 46 | + "employer": "Employer Name", // optional |
| 47 | + "employerURL": "https://employer-website.com", // required if employer is provided |
| 48 | + "title": "Job Title", |
| 49 | + "publication": "https://publication-url.com", // optional |
| 50 | + "type": "Employment", // or 'Personal Project', 'School (MSc)', etc. |
| 51 | + "url": "https://project-url.com", // optional |
| 52 | + "urls": [ |
| 53 | + // this is used to create a series of buttons with links |
| 54 | + { |
| 55 | + "text": "Link Text", |
| 56 | + "tooltip": "Tooltip description", |
| 57 | + "icon": "IconComponent", // this is a JSX component |
| 58 | + "url": "https://link-url.com" |
| 59 | + } |
| 60 | + ], |
| 61 | + "color": "#colorCode", |
| 62 | + "dates": { |
| 63 | + "startDate": "YYYY-MM", |
| 64 | + "endDate": "YYYY-MM" // or current if ongoing |
| 65 | + }, |
| 66 | + "showcase": true, // or false |
| 67 | + "objectFit": "contain" // optional, cover is used if nothing is provided |
| 68 | + } |
| 69 | + ``` |
| 70 | + |
| 71 | +### Adding Thumbnail Images |
| 72 | + |
| 73 | +To add a thumbnail image for the new project, place the image in the appropriate directory: |
| 74 | + |
| 75 | +1. **Navigate to the images directory**: Go to the [public image projects directory](../../public/images/projects). |
| 76 | +2. **Create a new directory**: Create a new directory with the project ID (e.g., new-project). |
| 77 | +3. **Add the thumbnail image**: Place the thumbnail image in the new directory and name it thumbnail. Recommended to use `.webp` format for better performance. |
| 78 | + |
| 79 | +By following these steps, you can successfully add new projects to the projects grid. |
0 commit comments