Skip to content

Commit eccbf2e

Browse files
committed
v6
1 parent 57b1f16 commit eccbf2e

File tree

14 files changed

+161
-16
lines changed

14 files changed

+161
-16
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@testing-library/jest-dom": "^6.9.1",
88
"@testing-library/react": "^16.3.0",
99
"@testing-library/user-event": "^13.5.0",
10+
"front-matter": "^4.0.2",
1011
"react": "^19.2.0",
1112
"react-dom": "^19.2.0",
1213
"react-markdown": "^10.1.0",

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1414
<link rel="preconnect" href="https://fonts.googleapis.com">
1515
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
16-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
16+
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
1717
<title>React App</title>
1818
</head>
1919
<body class="bg-gray-950">

public/posts/first-post.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: My First Post
33
date: 2025-10-14
4+
tags: ["react", "hello-world"]
45
---
56

67
# My First Post

public/posts/long-post.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: The Art of Scrolling
3+
date: 2025-10-16
4+
tags: ["css", "scrolling", "web-design"]
5+
---
6+
7+
# The Art of Scrolling
8+
9+
This is a very long blog post designed to demonstrate the scrolling behavior of the sticky metadata component.
10+
11+
## Chapter 1: The Beginning
12+
13+
In the beginning, there was no scrolling. Pages were static and everything fit on one screen. It was a simpler time, but also a more limited time. The invention of the scrollbar changed everything. Suddenly, pages could be as long as you wanted them to be. This was a revolutionary idea, and it paved the way for the modern web.
14+
15+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl.
16+
17+
## Chapter 2: The Middle
18+
19+
As pages got longer, it became more difficult to navigate them. This is where sticky elements came in. Sticky elements are elements that stay in a fixed position on the screen, even when you scroll. This is useful for things like navigation bars, sidebars, and metadata. In this blog post, we are using a sticky metadata component to display the title and date of the post.
20+
21+
Here's a link to a great resource on scrolling: [CSS-Tricks](https://css-tricks.com/pure-css-scroll-snap-in-action/).
22+
23+
And here's a link to another page on this site: [My Projects](/projects).
24+
25+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl.
26+
27+
## Chapter 3: The End
28+
29+
And so, we have come to the end of our long blog post. I hope you have enjoyed this demonstration of scrolling behavior. As you can see, the sticky metadata component has stayed in a fixed position on the screen, even as you have scrolled through the post. This is a very useful feature, and it is one that you will see on many websites.
30+
31+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl.
32+
33+
## Chapter 4: The Epilogue
34+
35+
But wait, there's more! I wanted to make this post even longer, so I added an epilogue. I hope you don't mind. I just wanted to make sure that the scrolling behavior was really, really clear. I think it is now. I think this is probably the longest blog post ever written. I'm not sure, but it's got to be up there.
36+
37+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl. Sed euismod, nisl nec ultricies lacinia, nisl nisl aliquet nisl, eget aliquam nisl nisl sit amet nisl.

public/posts/second-post.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: My Second Post
33
date: 2025-10-15
4+
tags: ["writing", "updates"]
45
---
56

67
# My Second Post

src/components/Label.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const Label = ({ children }) => {
4+
return (
5+
<span className="inline-block bg-gray-700 text-gray-300 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded-full">
6+
{children}
7+
</span>
8+
);
9+
};
10+
11+
export default Label;

src/components/Logo.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
3+
const Logo = () => {
4+
return (
5+
<svg
6+
className="h-8 w-8 text-white"
7+
fill="none"
8+
viewBox="0 0 24 24"
9+
stroke="currentColor"
10+
>
11+
<path
12+
strokeLinecap="round"
13+
strokeLinejoin="round"
14+
strokeWidth={2}
15+
d="M4 4v16h16V4H4zm0 8h16M4 12h16"
16+
/>
17+
</svg>
18+
);
19+
};
20+
21+
export default Logo;

src/components/Navbar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState, useEffect } from 'react';
22
import { Link } from 'react-router-dom';
3+
import Logo from './Logo';
34

45
const Navbar = () => {
56
const [isScrolled, setIsScrolled] = useState(false);
@@ -17,8 +18,9 @@ const Navbar = () => {
1718
return (
1819
<header className={`backdrop-blur-sm sticky top-0 z-40 transition-colors border-b ${isScrolled ? 'border-gray-700/50' : 'border-transparent'}`}>
1920
<div className="container mx-auto flex justify-between items-center p-4 text-white">
20-
<Link to="/" className="text-2xl font-semibold tracking-tight">
21-
My Awesome Blog
21+
<Link to="/" className="flex items-center space-x-2">
22+
<Logo />
23+
<span className="text-2xl font-semibold tracking-tight">fezcode</span>
2224
</Link>
2325
<div className="flex items-center space-x-6">
2426
<Link to="/" className="text-sm font-medium hover:text-gray-300 transition-colors">Home</Link>

src/components/PostMetadata.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react';
2+
import Label from './Label';
3+
4+
const PostMetadata = ({ metadata }) => {
5+
if (!metadata) {
6+
return null;
7+
}
8+
9+
return (
10+
<aside className="sticky top-24">
11+
<div className="p-6 bg-gray-800/50 rounded-lg border border-gray-700/50">
12+
<h3 className="text-lg font-semibold text-white mb-4">About Post</h3>
13+
<div className="space-y-4">
14+
<div>
15+
<Label>Title</Label>
16+
<p className="text-gray-300">{metadata.title}</p>
17+
</div>
18+
<div>
19+
<Label>Date</Label>
20+
<p className="text-gray-300">{metadata.date.toLocaleDateString()}</p>
21+
</div>
22+
{metadata.tags && (
23+
<div>
24+
<Label>Tags</Label>
25+
<div className="flex flex-wrap gap-2 mt-2">
26+
{metadata.tags.map(tag => (
27+
<span key={tag} className="bg-teal-400/10 text-teal-400 text-xs font-medium px-2.5 py-1 rounded-full">
28+
{tag}
29+
</span>
30+
))}
31+
</div>
32+
</div>
33+
)}
34+
</div>
35+
</div>
36+
</aside>
37+
);
38+
};
39+
40+
export default PostMetadata;

0 commit comments

Comments
 (0)