Skip to content

Commit 3249f02

Browse files
Merge pull request #91 from syntaxandsips/mr-dark-debug/update-blog-layout-and-fix-cluttered-text
fix: refresh blog layouts and typography
2 parents c1edb38 + 888fb9f commit 3249f02

File tree

5 files changed

+163
-80
lines changed

5 files changed

+163
-80
lines changed

src/app/blogs/[slug]/NewBlogPostClient.tsx

Lines changed: 27 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ import {
99
Eye,
1010
Twitter,
1111
Linkedin,
12-
Github,
1312
Share2,
1413
Copy,
1514
Check,
1615
ArrowUpRight,
1716
} from 'lucide-react';
1817
import { NewMarkdownRenderer } from '@/components/ui/NewMarkdownRenderer';
1918
import { NewSummarizeButton } from '@/components/ui/NewSummarizeButton';
20-
import { SocialFollowItem } from '@/components/ui/SocialFollowItem';
2119
import { CommentsSection } from '@/components/ui/CommentsSection';
2220
import { Breadcrumbs, type BreadcrumbItem } from '@/components/ui/Breadcrumbs';
21+
import { NewFollowSection } from '@/components/ui/NewFollowSection';
2322
import type { BlogListPost, BlogPostDetail } from '@/lib/posts';
2423

2524
interface BlogPostClientProps {
@@ -116,6 +115,28 @@ export default function NewBlogPostClient({ post, relatedPosts, canonicalUrl, br
116115
[copyState, handleCopyLink, post.title, shareUrl],
117116
);
118117

118+
const recommendedTopics = useMemo(() => {
119+
const unique = new Set<string>();
120+
const register = (value: string | null | undefined) => {
121+
if (!value) {
122+
return;
123+
}
124+
125+
const trimmed = value.trim();
126+
if (trimmed.length > 0) {
127+
unique.add(trimmed);
128+
}
129+
};
130+
131+
register(post.category.name ?? post.category.slug ?? null);
132+
post.tags.forEach((tag) => register(tag));
133+
relatedPosts.forEach((related) => {
134+
register(related.category.name ?? related.category.slug ?? null);
135+
});
136+
137+
return Array.from(unique);
138+
}, [post.category.name, post.category.slug, post.tags, relatedPosts]);
139+
119140
return (
120141
<div className="w-full bg-[#f0f0f0]">
121142
<div className="container mx-auto px-4 py-8">
@@ -126,7 +147,7 @@ export default function NewBlogPostClient({ post, relatedPosts, canonicalUrl, br
126147
>
127148
<ArrowLeft size={18} /> BACK TO BLOGS
128149
</Link>
129-
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
150+
<div className="grid grid-cols-1 gap-8 lg:grid-cols-3">
130151
<div className="lg:col-span-2">
131152
<article className="bg-white border-4 border-black rounded-lg overflow-hidden">
132153
<div className="p-6 border-b-4 border-black">
@@ -262,52 +283,9 @@ export default function NewBlogPostClient({ post, relatedPosts, canonicalUrl, br
262283
</div>
263284
</article>
264285
</div>
265-
<div className="lg:col-span-1 space-y-8">
266-
<div className="border-4 border-black bg-white p-6 rounded-lg">
267-
<h3 className="text-xl font-bold mb-4">AI and ML Insights</h3>
268-
<div className="flex flex-wrap gap-2">
269-
<button className="px-3 py-1 border-2 border-black rounded-md bg-white hover:bg-black hover:text-white transition">
270-
Artificial Intelligence
271-
</button>
272-
<button className="px-3 py-1 border-2 border-black rounded-md bg-white hover:bg-black hover:text-white transition">
273-
Machine Learning
274-
</button>
275-
<button className="px-3 py-1 border-2 border-black rounded-md bg-white hover:bg-black hover:text-white transition">
276-
Neural Networks
277-
</button>
278-
<button className="px-3 py-1 border-2 border-black rounded-md bg-white hover:bg-black hover:text-white transition">
279-
Data Science
280-
</button>
281-
<button className="px-3 py-1 border-2 border-black rounded-md bg-white hover:bg-black hover:text-white transition">
282-
Computer Vision
283-
</button>
284-
<button className="px-3 py-1 border-2 border-black rounded-md bg-white hover:bg-black hover:text-white transition">
285-
Reinforcement Learning
286-
</button>
287-
</div>
288-
<button className="text-[#6C63FF] font-bold hover:underline mt-4">
289-
See more topics
290-
</button>
291-
</div>
292-
<div className="border-4 border-black bg-white p-6 rounded-lg">
293-
<h3 className="text-xl font-bold mb-4">Follow Syntax &amp; Sips</h3>
294-
<div className="space-y-4">
295-
<SocialFollowItem
296-
platform="Twitter"
297-
handle="@syntaxandsips"
298-
icon={<Twitter className="h-6 w-6 text-[#1DA1F2]" />}
299-
/>
300-
<SocialFollowItem
301-
platform="LinkedIn"
302-
handle="/company/syntaxandsips"
303-
icon={<Linkedin className="h-6 w-6 text-[#0A66C2]" />}
304-
/>
305-
<SocialFollowItem
306-
platform="GitHub"
307-
handle="syntaxandsips"
308-
icon={<Github className="h-6 w-6 text-black" />}
309-
/>
310-
</div>
286+
<div className="lg:col-span-1 lg:self-start">
287+
<div className="lg:sticky lg:top-24">
288+
<NewFollowSection topics={recommendedTopics} />
311289
</div>
312290
</div>
313291
</div>

src/app/globals.css

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,82 @@ body {
271271
border-radius: 0.25rem;
272272
}
273273

274+
.markdown-content {
275+
color: rgb(17 24 39);
276+
font-size: 1.05rem;
277+
line-height: 1.85;
278+
word-break: break-word;
279+
}
280+
281+
.markdown-content > *:first-child {
282+
margin-top: 0;
283+
}
284+
285+
.markdown-content p,
286+
.markdown-content ul,
287+
.markdown-content ol,
288+
.markdown-content blockquote,
289+
.markdown-content pre,
290+
.markdown-content table,
291+
.markdown-content img,
292+
.markdown-content figure {
293+
margin-top: 0;
294+
margin-bottom: 1.5rem;
295+
}
296+
297+
.markdown-content h2,
298+
.markdown-content h3,
299+
.markdown-content h4 {
300+
font-weight: 800;
301+
color: rgb(17 24 39);
302+
margin-top: 2.5rem;
303+
margin-bottom: 1rem;
304+
line-height: 1.25;
305+
}
306+
307+
.markdown-content h2 {
308+
font-size: clamp(1.75rem, 2vw + 1rem, 2.25rem);
309+
}
310+
311+
.markdown-content h3 {
312+
font-size: clamp(1.5rem, 1.5vw + 1rem, 1.75rem);
313+
}
314+
315+
.markdown-content h4 {
316+
font-size: clamp(1.25rem, 1.2vw + 0.9rem, 1.5rem);
317+
}
318+
319+
.markdown-content ul {
320+
padding-left: 1.5rem;
321+
list-style-type: disc;
322+
}
323+
324+
.markdown-content ol {
325+
padding-left: 1.5rem;
326+
list-style-type: decimal;
327+
}
328+
329+
.markdown-content li + li {
330+
margin-top: 0.75rem;
331+
}
332+
333+
.markdown-content blockquote {
334+
border-left: 4px solid rgb(108 99 255);
335+
padding-left: 1.25rem;
336+
font-style: italic;
337+
background-color: rgba(108, 99, 255, 0.08);
338+
border-radius: 0.5rem;
339+
padding-top: 0.75rem;
340+
padding-bottom: 0.75rem;
341+
}
342+
343+
.markdown-content code:not([class]) {
344+
background-color: rgb(229 231 235);
345+
padding: 0.25rem 0.4rem;
346+
border-radius: 0.4rem;
347+
font-size: 0.95em;
348+
}
349+
274350
.dark {
275351
--background: oklch(0.145 0 0);
276352
--foreground: oklch(0.985 0 0);

src/components/neobrutal/toggle-switch.tsx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,24 @@ export const NeobrutalToggleSwitch = forwardRef<
1717
NeobrutalToggleSwitchProps
1818
>(
1919
(
20-
{ checked, onCheckedChange, label, onLabel = 'On', offLabel = 'Off', className, ...rest },
20+
{
21+
checked,
22+
onCheckedChange,
23+
label,
24+
onLabel = 'On',
25+
offLabel = 'Off',
26+
className,
27+
'aria-label': ariaLabel,
28+
...rest
29+
},
2130
ref,
2231
) => {
2332
const handleClick = () => {
2433
onCheckedChange?.(!checked)
2534
}
2635

36+
const accessibleLabel = ariaLabel ?? (checked ? onLabel : offLabel)
37+
2738
return (
2839
<div className={cn('flex items-center gap-3', className)}>
2940
{label ? (
@@ -36,32 +47,41 @@ export const NeobrutalToggleSwitch = forwardRef<
3647
type="button"
3748
role="switch"
3849
aria-checked={checked}
50+
aria-label={accessibleLabel}
3951
onClick={handleClick}
4052
className={cn(
41-
'relative flex h-9 w-20 items-center rounded-full border-4 border-black bg-white px-1 transition-transform',
53+
'relative grid h-10 w-36 grid-cols-2 items-center rounded-full border-4 border-black bg-white text-[11px] font-black uppercase tracking-wide transition-shadow duration-200 ease-out',
4254
checked
43-
? 'bg-[#6C63FF] text-white shadow-[4px_4px_0px_0px_rgba(0,0,0,0.16)]'
44-
: 'bg-white text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,0.08)]',
55+
? 'shadow-[4px_4px_0px_0px_rgba(0,0,0,0.16)]'
56+
: 'shadow-[4px_4px_0px_0px_rgba(0,0,0,0.08)]',
4557
)}
4658
{...rest}
4759
>
4860
<span
61+
aria-hidden
62+
className={cn(
63+
'pointer-events-none absolute inset-y-1 left-1 z-0 rounded-full border-2 border-black bg-[#6C63FF] transition-transform duration-200 ease-out',
64+
'w-[calc(50%-0.375rem)]',
65+
checked ? 'translate-x-[calc(100%+0.75rem)]' : 'translate-x-0',
66+
)}
67+
/>
68+
<span
69+
aria-hidden
4970
className={cn(
50-
'flex h-6 w-6 items-center justify-center rounded-full border-2 border-black bg-white font-bold transition-transform',
51-
checked ? 'translate-x-11 bg-[#FFD166]' : 'translate-x-0',
71+
'relative z-10 text-center transition-colors duration-200 ease-out',
72+
checked ? 'text-black' : 'text-white drop-shadow-[1px_1px_0px_rgba(0,0,0,0.45)]',
5273
)}
5374
>
54-
{checked ? '✓' : ''}
75+
{offLabel}
5576
</span>
5677
<span
78+
aria-hidden
5779
className={cn(
58-
'pointer-events-none absolute inset-0 flex items-center justify-center text-[11px] font-black uppercase tracking-wide transition-colors',
59-
checked
60-
? 'text-white drop-shadow-[1px_1px_0px_rgba(0,0,0,0.45)]'
61-
: 'text-black',
80+
'relative z-10 text-center transition-colors duration-200 ease-out',
81+
checked ? 'text-white drop-shadow-[1px_1px_0px_rgba(0,0,0,0.45)]' : 'text-black',
6282
)}
6383
>
64-
{checked ? onLabel : offLabel}
84+
{onLabel}
6585
</span>
6686
</button>
6787
</div>

src/components/ui/NewBlogsHeader.tsx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,29 @@ import React from 'react';
22

33
export function NewBlogsHeader() {
44
return (
5-
<div className="text-center mb-16 relative">
6-
<div className="absolute -top-6 -left-6 w-16 h-16 bg-[#FFD166] border-4 border-black rounded-full transform rotate-12"></div>
7-
<div className="absolute -bottom-6 -right-6 w-16 h-16 bg-[#FF5252] border-4 border-black transform -rotate-12"></div>
8-
<div className="relative">
9-
<h1 className="text-5xl md:text-7xl font-black mb-6 leading-tight">
10-
<span className="bg-[#6C63FF] text-white px-4 py-2 inline-block transform rotate-1 border-4 border-black">
11-
AI & ML
12-
</span>{' '}
13-
<span className="bg-[#FF5252] text-white px-4 py-2 inline-block transform -rotate-1 border-4 border-black">
14-
Insights
5+
<div className="relative mb-12 overflow-hidden rounded-3xl border-4 border-black bg-white px-6 py-10 text-left shadow-[10px_10px_0px_rgba(0,0,0,0.12)]">
6+
<div className="pointer-events-none absolute -left-10 top-6 hidden h-24 w-24 rotate-6 rounded-full border-4 border-black bg-[#FFD166] md:block" />
7+
<div className="pointer-events-none absolute -right-12 -bottom-8 hidden h-28 w-28 -rotate-12 border-4 border-black bg-[#6C63FF] md:block" />
8+
<div className="relative flex flex-col gap-6 md:flex-row md:items-center md:justify-between">
9+
<div className="max-w-2xl space-y-4">
10+
<p className="inline-flex items-center rounded-full border-2 border-black bg-[#FFD166] px-3 py-1 text-xs font-black uppercase tracking-[0.3em] text-black shadow-[4px_4px_0px_rgba(0,0,0,0.12)]">
11+
Explore syntax &amp; sips
12+
</p>
13+
<h1 className="text-4xl font-black leading-tight text-gray-900 sm:text-5xl">
14+
Discover stories, tutorials, and community updates from the Syntax &amp; Sips collective.
15+
</h1>
16+
<p className="text-lg font-medium text-gray-700">
17+
Browse the entire library, search by topic, or filter by interests to find your next read without the clutter.
18+
</p>
19+
</div>
20+
<div className="flex flex-col gap-3 text-sm font-bold uppercase tracking-wide text-gray-700">
21+
<span className="inline-flex items-center gap-2 rounded-xl border-2 border-black bg-[#FF5252] px-4 py-3 text-white shadow-[6px_6px_0px_rgba(0,0,0,0.16)]">
22+
Fresh posts weekly
1523
</span>
16-
</h1>
17-
<p className="mt-6 text-xl text-center max-w-2xl mx-auto">
18-
Exploring the cutting edge of artificial intelligence, machine learning, data science workflows, quantum computing,
19-
coding tutorials, and product reviews.
20-
</p>
24+
<span className="inline-flex items-center gap-2 rounded-xl border-2 border-black bg-[#06D6A0] px-4 py-3 text-black shadow-[6px_6px_0px_rgba(0,0,0,0.16)]">
25+
Curated by our editors
26+
</span>
27+
</div>
2128
</div>
2229
</div>
2330
);

src/components/ui/NewBlogsPage.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ export function NewBlogsPage({ posts }: NewBlogsPageProps) {
162162
};
163163

164164
return (
165-
<div className="container mx-auto px-4 py-8">
165+
<div className="container mx-auto px-4 pb-14 pt-10">
166166
<NewBlogsHeader />
167-
<div className="mt-8 flex flex-col gap-10 lg:flex-row">
167+
<div className="mt-8 flex flex-col gap-10 lg:flex-row lg:items-start">
168168
<div className="w-full lg:w-8/12">
169169
<NeobrutalCard className="flex flex-col gap-6">
170170
<div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
@@ -235,8 +235,10 @@ export function NewBlogsPage({ posts }: NewBlogsPageProps) {
235235
</div>
236236
</NeobrutalCard>
237237
</div>
238-
<div className="w-full lg:w-4/12">
239-
<NewFollowSection topics={recommendedTopics} />
238+
<div className="w-full lg:w-4/12 lg:self-start">
239+
<div className="lg:sticky lg:top-24">
240+
<NewFollowSection topics={recommendedTopics} />
241+
</div>
240242
</div>
241243
</div>
242244
</div>

0 commit comments

Comments
 (0)