Skip to content

Commit 2aa5fe2

Browse files
committed
Updated Comments/Blog
Solving bug not displaying blogs, better styling overall
1 parent 3f9a7b5 commit 2aa5fe2

17 files changed

Lines changed: 483 additions & 171 deletions

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Node.js dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Logs
8+
logs/
9+
*.log
10+
*.log.*
11+
12+
# OS generated files
13+
.DS_Store
14+
Thumbs.db
15+
16+
# Temporary files
17+
*.tmp
18+
*.swp
19+
*.swo
20+
*.bak
21+
22+
# Build output
23+
dist/
24+
build/
25+
26+
# Git files
27+
.git/

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# ~
2-
Repository for a personal site.
1+
# Robin's Personal Site
2+
3+
This repository contains the source code for my personal website. The site serves as a platform to share my thoughts, projects, and other content I find interesting.
4+
5+
## Features
6+
7+
- **Blog**: Posts about various topics, including school, life, and random ideas.
8+
- **Projects**: A showcase of personal projects and experiments.
9+
- **Comments**: Visitors can leave comments on posts, with support for author names and timestamps.
10+
- **Dark Mode**: Toggle between light and dark themes.
11+
- **Math Support**: Render mathematical expressions using MathJax.
12+
- **Markdown Parsing**: Blog posts are written in Markdown and rendered dynamically.
13+
14+
## Tech Stack
15+
16+
- **Frontend**: HTML, CSS, JavaScript
17+
- **Libraries**:
18+
- [Marked.js](https://github.com/markedjs/marked) for Markdown parsing
19+
- [MathJax](https://www.mathjax.org/) for rendering math
20+
- **Backend**: Node.js API (serverless) to handle posting and fetching comments
21+
22+
## Contact
23+
24+
Feel free to reach out via:
25+
26+
- **Email**: robinchen@nyu.edu
27+
- **Github**: [localhost433](https://github.com/localhost433)

about.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ <h2>What You Might Find Here</h2>
3737
<h2>Connect with Me</h2>
3838
<p>
3939
You can find me here:
40+
</p>
4041
<ul>
4142
<li><a href="https://github.com/localhost433" target="_blank">GitHub</a></li>
4243
<li><a href="https://www.linkedin.com/in/robin-chen-a494542b7/" target="_blank">LinkedIn</a></li>
4344
</ul>
45+
<p>
46+
Or you can email me at <a href="mailto: robinchen@nyu.edu">robinchen@nyu.edu</a>
4447
</p>
4548

4649
<h2>Tech Stack</h2>

api/comments.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
export default async function handler(req, res) {
33
const fs = require('fs');
44
const path = require('path');
5+
6+
// Ensure the request body is parsed
7+
if (req.method === 'POST' && !req.body) {
8+
return res.status(400).json({ error: "Invalid or missing request body" });
9+
}
510

611
const filePath = path.join(process.cwd(), 'comments.json');
712

@@ -28,13 +33,14 @@ export default async function handler(req, res) {
2833
if (!data[slug]) {
2934
data[slug] = [];
3035
}
36+
const timestamp = Date.now();
3137
data[slug].push({
3238
text,
33-
timestamp: Date.now(),
39+
timestamp,
3440
});
3541

3642
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
37-
return res.status(201).json({ text, timestamp: Date.now() });
43+
return res.status(201).json({ text, timestamp });
3844
}
3945

4046
res.setHeader('Allow', ['GET', 'POST']);

components/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<footer>
2-
<p style="text-align:center; font-size:0.9rem; color:#777;">&copy; 2025 Robin. All rights reserved.</p>
2+
<small style="text-align:center; font-size:0.9rem; color:#777; display:block;">&copy; 2025 Robin. All rights reserved.</small>
33
</footer>

components/header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
<div class="header-row">
99
<p>Welcome! Sharing ideas, projects, school notes, and more.</p>
1010
<button id="theme-toggle">Dark Mode</button>
11+
</div>
1112
</div>

css/about.css

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* about.css */
2+
3+
/* General styles for the about page */
4+
body {
5+
font-family: Arial, sans-serif;
6+
margin: 0;
7+
padding: 0;
8+
background-color: #f9f9f9;
9+
color: #333;
10+
}
11+
12+
header {
13+
background-color: #4CAF50;
14+
color: white;
15+
padding: 20px;
16+
text-align: center;
17+
}
18+
19+
h1 {
20+
font-size: 2.5em;
21+
margin: 20px 0;
22+
}
23+
24+
p {
25+
line-height: 1.6;
26+
margin: 10px 20px;
27+
}
28+
29+
/* Section styles */
30+
section {
31+
margin: 20px auto;
32+
max-width: 800px;
33+
padding: 20px;
34+
background-color: white;
35+
border-radius: 8px;
36+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
37+
}
38+
39+
/* Links */
40+
a {
41+
color: #4CAF50;
42+
text-decoration: none;
43+
}
44+
45+
a:hover {
46+
text-decoration: underline;
47+
}
48+
49+
/* Footer styles */
50+
footer {
51+
text-align: center;
52+
padding: 10px;
53+
background-color: #333;
54+
color: white;
55+
position: relative;
56+
bottom: 0;
57+
width: 100%;
58+
}

css/home.css

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,29 @@ body {
1010
}
1111

1212
a {
13-
color: #0044cc;
13+
color: #0055aa;
1414
text-decoration: none;
1515
font-weight: 600;
1616
}
1717

18-
a:hover {
18+
a:hover,
19+
a:focus {
1920
text-decoration: underline;
2021
}
2122

2223
/* Header */
2324
header h1,
2425
.header-title {
25-
font-size: 2.1rem;
26+
font-size: 2rem;
2627
color: #000;
27-
margin-bottom: 0.3rem;
28+
margin-bottom: 0.5rem;
2829
}
2930

3031
header p,
3132
.header-row p {
32-
font-size: 1.3rem;
33-
color: #444;
34-
margin-bottom: 1.1rem;
33+
font-size: 1.2rem;
34+
color: #555;
35+
margin-bottom: 1rem;
3536
}
3637

3738
.header-row {
@@ -43,20 +44,24 @@ header p,
4344

4445
/* Post Listing */
4546
#posts-list {
46-
margin-top: 2.1rem;
47+
margin-top: 2rem;
4748
}
4849

4950
.post-entry {
50-
margin-bottom: 2.1rem;
51+
display: flex;
52+
justify-content: space-between;
53+
align-items: center;
54+
margin-bottom: 1.5rem;
55+
flex-wrap: wrap;
5156
}
5257

5358
.post-entry a {
54-
font-size: 1.3rem;
59+
font-size: 1.2rem;
5560
}
5661

5762
.post-date,
5863
.post-meta {
59-
font-size: 0.8rem;
64+
font-size: 0.85rem;
6065
color: #777;
6166
}
6267

@@ -66,28 +71,45 @@ header p,
6671
}
6772

6873
.post-author {
69-
color: #444;
74+
color: #555;
75+
}
76+
77+
.post-title {
78+
font-weight: bold;
79+
font-size: 1.2rem;
80+
color: #0055aa;
81+
text-decoration: none;
82+
}
83+
84+
.post-title:hover {
85+
text-decoration: underline;
86+
}
87+
88+
.post-meta-inline {
89+
font-size: 0.85rem;
90+
color: #777;
91+
margin-left: 1rem;
7092
}
7193

7294
/* Individual Post */
7395
article {
74-
margin-top: 3.4rem;
96+
margin-top: 3rem;
7597
}
7698

7799
article h1,
78100
article h2 {
79101
color: #000;
80-
margin: 1.3rem 0;
102+
margin: 1.5rem 0;
81103
}
82104

83105
article p {
84-
margin-bottom: 1.3rem;
106+
margin-bottom: 1.2rem;
85107
}
86108

87109
/* Back Link */
88110
.back-link {
89111
display: block;
90-
margin-top: 2.1rem;
112+
margin-top: 2rem;
91113
color: #555;
92114
}
93115

@@ -140,32 +162,6 @@ article p {
140162
color: #bbbbbb;
141163
}
142164

143-
.post-entry {
144-
display: flex;
145-
justify-content: space-between;
146-
align-items: center;
147-
margin-bottom: 1.3rem;
148-
flex-wrap: wrap;
149-
/* Allow wrapping on smaller screens */
150-
}
151-
152-
.post-title {
153-
font-weight: bold;
154-
font-size: 1.3rem;
155-
color: #0055aa;
156-
text-decoration: none;
157-
}
158-
159-
.post-title:hover {
160-
text-decoration: underline;
161-
}
162-
163-
.post-meta-inline {
164-
font-size: 0.85rem;
165-
color: #888;
166-
margin-left: 1rem;
167-
}
168-
169165
.dark-mode .post-meta-inline {
170-
color: #bbb;
166+
color: #bbbbbb;
171167
}

0 commit comments

Comments
 (0)