Skip to content

Commit 829e316

Browse files
authored
Merge pull request #305 from tjklint/refactor(1page)
docs: commented projects.tsx for better code readabliity.
2 parents 0d04831 + e46ad7f commit 829e316

File tree

1 file changed

+118
-97
lines changed

1 file changed

+118
-97
lines changed

src/components/projects/projects.tsx

Lines changed: 118 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -2,186 +2,207 @@ import React from 'react';
22
import styled from 'styled-components';
33
import { FaGithub, FaGlobe } from 'react-icons/fa';
44

5+
// Importing assets for project GIFs
56
import investSmartGif from '../../assets/projects/InvestSmart.gif';
67
import pokePCGif from '../../assets/projects/PokePC.gif';
78
import privacyXPressoGif from '../../assets/projects/PrivacyXPresso.gif';
89
import portfolioGif from '../../assets/projects/Portfolio.gif';
910

11+
// Main container for all projects, handles layout and styling
1012
const ProjectsContainer = styled.div`
1113
display: flex;
12-
flex-direction: column;
13-
align-items: center;
14-
color: #fff;
14+
flex-direction: column; /* Stack projects vertically */
15+
align-items: center; /* Center all content horizontally */
16+
color: #fff; /* White text color */
1517
font-family: 'RobotoMono', sans-serif;
16-
padding: 0 10px;
17-
overflow-x: hidden;
18-
width: 80%;
19-
margin: 0 auto;
18+
padding: 0 10px; /* Padding for horizontal content */
19+
overflow-x: hidden; /* Prevent horizontal scrolling */
20+
width: 80%; /* Set container width */
21+
margin: 0 auto; /* Center the container */
2022
`;
2123

24+
// Title for the projects section
2225
const SectionTitle = styled.h2`
23-
font-size: 2.5em;
24-
margin-bottom: 20px;
25-
text-align: left;
26-
width: 100%;
27-
box-sizing: border-box;
26+
font-size: 2.5em; /* Large font size for section title */
27+
margin-bottom: 20px; /* Space below the title */
28+
text-align: left; /* Align text to the left */
29+
width: 100%; /* Take up full width of the container */
30+
box-sizing: border-box; /* Include padding and borders in width calculation */
2831
`;
2932

33+
// Container for big projects, aligns them vertically
3034
const BigProjectsContainer = styled.div`
3135
display: flex;
32-
flex-direction: column;
33-
align-items: center;
34-
width: 100%;
36+
flex-direction: column; /* Stack big projects vertically */
37+
align-items: center; /* Center content horizontally */
38+
width: 100%; /* Full width for the big projects container */
3539
`;
3640

41+
// Container for individual projects, handles layout and background styling
3742
const ProjectContainer = styled.div`
38-
width: 100%;
39-
margin-bottom: 40px;
40-
background: rgba(0, 0, 0, 0.6);
41-
border-radius: 10px;
42-
padding: 20px;
43-
text-align: center;
44-
position: relative;
45-
overflow: hidden;
43+
width: 100%; /* Full width for individual projects */
44+
margin-bottom: 40px; /* Space below each project */
45+
background: rgba(0, 0, 0, 0.6); /* Semi-transparent dark background */
46+
border-radius: 10px; /* Rounded corners */
47+
padding: 20px; /* Padding around the project content */
48+
text-align: center; /* Center the text inside the project */
49+
position: relative; /* Relative positioning for background media */
50+
overflow: hidden; /* Ensure no content overflows outside the box */
4651
52+
/* Style for project images or videos */
4753
img, video {
48-
width: 100%;
49-
height: 100%;
50-
border-radius: 10px;
51-
object-fit: cover;
52-
position: absolute;
54+
width: 100%; /* Full width */
55+
height: 100%; /* Full height */
56+
border-radius: 10px; /* Rounded corners for the media */
57+
object-fit: cover; /* Cover the area without distortion */
58+
position: absolute; /* Position absolutely within the container */
5359
top: 0;
5460
left: 0;
55-
z-index: 0;
56-
opacity: 0.3;
61+
z-index: 0; /* Place the image or video behind text */
62+
opacity: 0.3; /* Semi-transparent to not overpower the text */
5763
}
5864
65+
/* Style for project titles */
5966
h3 {
60-
font-size: 2em;
61-
margin-bottom: 10px;
62-
z-index: 1;
63-
position: relative;
67+
font-size: 2em; /* Large font for project titles */
68+
margin-bottom: 10px; /* Space below the title */
69+
z-index: 1; /* Ensure the title is above the background media */
70+
position: relative; /* Keep relative positioning for z-index */
6471
}
6572
73+
/* Style for project description text */
6674
p {
67-
font-size: 1.2em;
68-
margin-bottom: 20px;
69-
z-index: 1;
70-
position: relative;
75+
font-size: 1.2em; /* Medium size for description */
76+
margin-bottom: 20px; /* Space below the description */
77+
z-index: 1; /* Ensure text is above the media */
78+
position: relative; /* Keep relative positioning */
7179
}
7280
81+
/* Style for the links section */
7382
.links {
74-
z-index: 1;
75-
position: relative;
76-
display: flex;
77-
justify-content: center;
78-
gap: 20px;
83+
z-index: 1; /* Ensure links are above the background media */
84+
position: relative; /* Relative positioning for z-index control */
85+
display: flex; /* Use flexbox for layout */
86+
justify-content: center; /* Center the links */
87+
gap: 20px; /* Space between links */
7988
}
8089
90+
/* Style for individual links */
8191
a {
82-
color: #9b59b6;
83-
font-size: 1.2em;
84-
display: flex;
85-
align-items: center;
86-
gap: 8px;
87-
text-decoration: none;
88-
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
92+
color: #9b59b6; /* Purple color for links */
93+
font-size: 1.2em; /* Font size for links */
94+
display: flex; /* Flex layout for link icon and text */
95+
align-items: center; /* Center icon and text vertically */
96+
gap: 8px; /* Space between icon and text */
97+
text-decoration: none; /* Remove underline from links */
98+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); /* Add text shadow for visibility */
8999
100+
/* Hover state for links */
90101
&:hover {
91-
color: #d4a1ff;
102+
color: #d4a1ff; /* Lighten the link color on hover */
92103
}
93104
}
94105
106+
/* Responsive styles for small screens */
95107
@media (max-width: 768px) {
96108
width: 100%;
97109
margin-bottom: 20px;
98110
padding: 10px;
99111
}
100112
`;
101113

114+
// Container for small projects, wraps them and spaces them out
102115
const SmallProjectsContainer = styled.div`
103116
display: flex;
104-
flex-wrap: wrap;
105-
justify-content: space-between;
106-
width: 100%;
117+
flex-wrap: wrap; /* Allow the projects to wrap to new rows */
118+
justify-content: space-between; /* Space projects out evenly */
119+
width: 100%; /* Full width for the small projects container */
107120
`;
108121

122+
// Container for individual small projects
109123
const SmallProject = styled.div`
110-
width: 45%;
111-
margin-bottom: 40px;
112-
background: rgba(0, 0, 0, 0.6);
113-
border-radius: 10px;
114-
padding: 20px;
115-
text-align: center;
116-
position: relative;
117-
overflow: hidden;
124+
width: 45%; /* Width for small projects (45% allows 2 per row) */
125+
margin-bottom: 40px; /* Space below each small project */
126+
background: rgba(0, 0, 0, 0.6); /* Semi-transparent dark background */
127+
border-radius: 10px; /* Rounded corners */
128+
padding: 20px; /* Padding around the content */
129+
text-align: center; /* Center text inside the project */
130+
position: relative; /* Relative positioning for background media */
131+
overflow: hidden; /* Prevent overflow outside the project box */
118132
133+
/* Style for project images or videos */
119134
img, video {
120-
width: 100%;
121-
height: 100%;
122-
border-radius: 10px;
123-
object-fit: cover;
124-
position: absolute;
135+
width: 100%; /* Full width for media */
136+
height: 100%; /* Full height for media */
137+
border-radius: 10px; /* Rounded corners for the media */
138+
object-fit: cover; /* Cover the area without distortion */
139+
position: absolute; /* Position the media absolutely */
125140
top: 0;
126141
left: 0;
127-
z-index: 0;
128-
opacity: 0.3;
142+
z-index: 0; /* Place the media behind the text */
143+
opacity: 0.3; /* Semi-transparent to not overpower text */
129144
}
130145
146+
/* Style for small project titles */
131147
h3 {
132-
font-size: 1.5em;
133-
margin-bottom: 10px;
134-
z-index: 1;
135-
position: relative;
148+
font-size: 1.5em; /* Smaller font for small project titles */
149+
margin-bottom: 10px; /* Space below the title */
150+
z-index: 1; /* Ensure title is above the background media */
151+
position: relative; /* Keep relative positioning */
136152
}
137153
154+
/* Style for small project description text */
138155
p {
139-
font-size: 1em;
140-
margin-bottom: 20px;
141-
z-index: 1;
142-
position: relative;
156+
font-size: 1em; /* Smaller font size for description */
157+
margin-bottom: 20px; /* Space below the description */
158+
z-index: 1; /* Ensure text is above the background media */
159+
position: relative; /* Keep relative positioning */
143160
}
144161
162+
/* Style for links in small projects */
145163
.links {
146-
z-index: 1;
147-
position: relative;
148-
display: flex;
149-
justify-content: center;
150-
gap: 20px;
164+
z-index: 1; /* Ensure links are above background media */
165+
position: relative; /* Relative positioning for z-index control */
166+
display: flex; /* Use flexbox for layout */
167+
justify-content: center; /* Center the links */
168+
gap: 20px; /* Space between the links */
151169
}
152170
171+
/* Style for individual links */
153172
a {
154-
color: #9b59b6;
155-
font-size: 1em;
156-
display: flex;
157-
align-items: center;
158-
gap: 8px;
159-
text-decoration: none;
160-
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
173+
color: #9b59b6; /* Purple color for links */
174+
font-size: 1em; /* Smaller font size for links */
175+
display: flex; /* Flex layout for icon and text */
176+
align-items: center; /* Align icon and text vertically */
177+
gap: 8px; /* Space between icon and text */
178+
text-decoration: none; /* Remove underline */
179+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); /* Text shadow for visibility */
161180
181+
/* Hover state for links */
162182
&:hover {
163-
color: #d4a1ff;
183+
color: #d4a1ff; /* Lighten link color on hover */
164184
}
165185
}
166186
167-
187+
/* Responsive styles for different screen sizes */
168188
@media (max-width: 1250px) {
169-
width: 45%;
189+
width: 45%; /* Maintain two columns on medium screens */
170190
}
171191
172192
@media (max-width: 968px) {
173-
width: 43%;
193+
width: 43%; /* Adjust slightly on smaller screens */
174194
}
175195
176196
@media (max-width: 768px) {
177-
width: 100%;
178-
margin: 0 auto 20px auto;
197+
width: 100%; /* Full width for small screens */
198+
margin: 0 auto 20px auto; /* Center and space out projects */
179199
}
180200
`;
181201

202+
// Handle the "Coming Soon" click event
182203
const handleComingSoonClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
183-
event.preventDefault();
184-
alert('Coming soon!');
204+
event.preventDefault(); /* Prevent the default link behavior */
205+
alert('Coming soon!'); /* Show an alert when clicked */
185206
};
186207

187208
const Projects: React.FC = () => {

0 commit comments

Comments
 (0)