Skip to content

Commit 1cd9b22

Browse files
committed
feat: rebuild website for styled-components v6.4
Ships a full site overhaul on top of Next.js App Router with a sidebar- driven information architecture, a new blog section, a v6.4 documentation pass, and a redesigned homepage. - Design system built on OKLCH tokens via createTheme, dark/light/auto modes with pre-hydration class sync, next/font for display/body/mono. - Homepage: two-column hero with a live editor, proof badges, company logos, CSS-bloom celebration effect for the v6 decade milestone. - Navigation: persistent sidebar with DocSearch, scroll-spy docs index, redesigned navbar, mobile hamburger. - Blog: MDX posts indexed via posts.json, year-as-poster layout, byline and colophon split, blog asset pipeline. - Docs: v6.4 refresh covering createTheme, ThemeProvider semantics, @Property registration, ServerStyleSheet/RSC plugin guidance; ships public/llms.txt as the machine cheatsheet. - Code rendering: unified HighlightedCode with shared prismLanguageSC grammar extensions and a logo-derived syntax palette. - Logo: CSS 3D Platonic solid cycling through five shapes with per-face OKLCH coloring. - Infrastructure: styled-components SSR registry, scroll-margin heading anchors, sitemap/robots, error/not-found boundaries, componentized live-code scope.
1 parent ec7c8c6 commit 1cd9b22

File tree

203 files changed

+8830
-6260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+8830
-6260
lines changed

.playwright-mcp/page-2026-04-09T01-05-48-242Z.yml

Lines changed: 376 additions & 0 deletions
Large diffs are not rendered by default.
21.5 KB
Loading

app/api/proxy/[asset]/route.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import axios from 'axios';
21
import { NextRequest, NextResponse } from 'next/server';
32

43
const proxyMap: Record<string, string> = {
54
'npm-v.svg': 'https://img.shields.io/npm/v/styled-components.svg',
6-
'size.svg': 'https://img.shields.io/badge/gzip%20size-12.4%20kB-brightgreen.svg',
75
'downloads.svg': 'https://img.shields.io/npm/dm/styled-components.svg?maxAge=3600',
86
'stars.svg':
97
'https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star&maxAge=3600',
@@ -23,11 +21,9 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
2321
}
2422

2523
try {
26-
const { data, headers } = await axios.get(remoteUrl, {
27-
responseType: 'arraybuffer',
28-
});
29-
30-
const contentType = headers['content-type'];
24+
const resp = await fetch(remoteUrl);
25+
const data = await resp.arrayBuffer();
26+
const contentType = resp.headers.get('content-type') || 'application/octet-stream';
3127

3228
return new NextResponse(data, {
3329
status: 200,
@@ -36,7 +32,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
3632
'cache-control': 's-maxage=3600,stale-while-revalidate',
3733
},
3834
});
39-
} catch (error) {
35+
} catch {
4036
return NextResponse.json({ error: 'Error fetching remote asset' }, { status: 500 });
4137
}
4238
}

app/blog/[slug]/page.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { notFound } from 'next/navigation';
2+
import BlogPostPage from '@/components/BlogPostPage';
3+
import CelebrationEffect from '@/components/CelebrationEffect';
4+
import posts from '@/sections/blog/posts.json';
5+
import { postBySlug } from '@/utils/blog';
6+
7+
export function generateStaticParams() {
8+
return posts.map(post => ({ slug: post.slug }));
9+
}
10+
11+
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
12+
const { slug } = await params;
13+
const post = postBySlug.get(slug);
14+
if (!post) return { title: 'Post Not Found' };
15+
16+
const mod = await import(`@/sections/blog/${post.date}-${post.slug}.mdx`);
17+
18+
return {
19+
title: mod.meta?.title ?? post.title,
20+
description: mod.meta?.description ?? `${post.title} by ${post.author}`,
21+
};
22+
}
23+
24+
export default async function BlogPost({ params }: { params: Promise<{ slug: string }> }) {
25+
const { slug } = await params;
26+
const post = postBySlug.get(slug);
27+
28+
if (!post) {
29+
notFound();
30+
}
31+
32+
let MdxContent: React.ComponentType;
33+
try {
34+
const mod = await import(`@/sections/blog/${post.date}-${post.slug}.mdx`);
35+
MdxContent = mod.default;
36+
} catch {
37+
notFound();
38+
}
39+
40+
return (
41+
<>
42+
{slug === 'celebrating-a-decade-of-styled-components' && <CelebrationEffect />}
43+
<BlogPostPage post={post}>
44+
<MdxContent />
45+
</BlogPostPage>
46+
</>
47+
);
48+
}

app/blog/blog.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Route-level overrides for blog pages.
2+
Static CSS to avoid the createGlobalStyle SSR -> client hydration flash. */
3+
4+
[data-e2e-id='content'] img {
5+
max-width: 100%;
6+
height: auto;
7+
border-radius: 4px;
8+
}
9+
10+
/* Magazine-style section break: short warm rule, generous air. */
11+
[data-e2e-id='content'] hr {
12+
border: 0;
13+
margin: 3.5rem auto;
14+
width: 4rem;
15+
height: 2px;
16+
background: var(--sc-color-blogAccent);
17+
opacity: 0.6;
18+
}

app/blog/layout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import './blog.css';
2+
3+
export default function BlogLayout({ children }: { children: React.ReactNode }) {
4+
return children;
5+
}

app/blog/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import BlogListPage from '@/components/BlogListPage';
2+
3+
export const metadata = {
4+
title: 'Blog',
5+
description: 'Articles and announcements from the styled-components team',
6+
};
7+
8+
export default function BlogPage() {
9+
return <BlogListPage />;
10+
}

app/docs.json

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"pages": [
33
{
4-
"title": "Basics",
4+
"title": "The Basics",
55
"pathname": "basics",
66
"sections": [
77
{
@@ -134,57 +134,23 @@
134134
"title": "FAQs",
135135
"pathname": "faqs",
136136
"sections": [
137-
{
138-
"title": "What do I need to do to migrate to v6?"
139-
},
140-
{
141-
"title": "How should I handle dynamic styles?"
142-
},
143-
{
144-
"title": "When to use attrs?"
145-
},
146-
{
147-
"title": "Why should I avoid declaring styled components in the render method?"
148-
},
149-
{
150-
"title": "Can I nest rules?"
151-
},
152-
{
153-
"title": "How can I override styles with higher specificity?"
154-
},
155-
{
156-
"title": "How can I override inline styles?"
157-
},
158-
{
159-
"title": "Why am I getting HTML attribute warnings?"
160-
},
161-
{
162-
"title": "Which browsers are supported?"
163-
},
164-
{
165-
"title": "Why do my DOM nodes have two classes?"
166-
},
167-
{
168-
"title": "Why am I getting a warning about several instances of module on the page?"
169-
},
170-
{
171-
"title": "Can I use css frameworks?"
172-
},
173-
{
174-
"title": "I am a library author. Should I bundle styled-components with my library?"
175-
},
176-
{
177-
"title": "How do I fix flickering text after server side rendering?"
178-
},
179-
{
180-
"title": "How can I fix issues when using npm link or yarn link?"
181-
},
182-
{
183-
"title": "Missing Declarations for styled-components/native?"
184-
},
185-
{
186-
"title": "What do I need to do to migrate to v5?"
187-
}
137+
{ "title": "What do I need to do to migrate to v6?" },
138+
{ "title": "What do I need to do to migrate to v5?" },
139+
{ "title": "How should I handle dynamic styles?" },
140+
{ "title": "When to use attrs?" },
141+
{ "title": "Why should I avoid declaring styled components in the render method?" },
142+
{ "title": "Can I nest rules?" },
143+
{ "title": "How can I override styles with higher specificity?" },
144+
{ "title": "How can I override inline styles?" },
145+
{ "title": "Can I use css frameworks?" },
146+
{ "title": "Why am I getting HTML attribute warnings?" },
147+
{ "title": "Why do my DOM nodes have two classes?" },
148+
{ "title": "Why am I getting a warning about several instances of module on the page?" },
149+
{ "title": "How do I fix flickering text after server side rendering?" },
150+
{ "title": "How can I fix issues when using npm link or yarn link?" },
151+
{ "title": "Missing Declarations for styled-components/native?" },
152+
{ "title": "Which browsers are supported?" },
153+
{ "title": "I am a library author. Should I bundle styled-components with my library?" }
188154
]
189155
}
190156
]

app/docs/advanced/page.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { Metadata } from 'next';
12
import DocsLayout from '@/components/DocsLayout';
2-
import NextPage from '@/components/NextPage';
3+
import DocsPageNav from '@/components/DocsPageNav';
34

45
import Theming from '@/sections/advanced/theming.mdx';
56
import ServerSideRendering from '@/sections/advanced/server-side-rendering.mdx';
@@ -12,12 +13,14 @@ import Refs from '@/sections/advanced/refs.mdx';
1213
import Security from '@/sections/advanced/security.mdx';
1314
import TaggedTemplateLiterals from '@/sections/advanced/tagged-template-literals.mdx';
1415

16+
export const metadata: Metadata = {
17+
title: 'Advanced Usage',
18+
description: 'Theming, Server-Side Rendering, Performance, Existing CSS, Style Objects, Accessibility and more',
19+
};
20+
1521
export default function AdvancedPage() {
1622
return (
17-
<DocsLayout
18-
title="Advanced Usage"
19-
description="Theming, Server-Side Rendering, Performance, Existing CSS, Style Objects, Accessibility and more"
20-
>
23+
<DocsLayout title="Advanced Usage">
2124
<Theming />
2225
<ServerSideRendering />
2326
<Performance />
@@ -28,7 +31,7 @@ export default function AdvancedPage() {
2831
<Refs />
2932
<Security />
3033
<TaggedTemplateLiterals />
31-
<NextPage href="/docs/api" title="API Reference" />
34+
<DocsPageNav current="advanced" />
3235
</DocsLayout>
3336
);
3437
}

app/docs/api/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { Metadata } from 'next';
12
import DocsLayout from '@/components/DocsLayout';
2-
import NextPage from '@/components/NextPage';
3+
import DocsPageNav from '@/components/DocsPageNav';
34

45
import Primary from '@/sections/api/primary/index.mdx';
56
import Helpers from '@/sections/api/helpers/index.mdx';
@@ -8,16 +9,21 @@ import TypeScript from '@/sections/api/typescript.mdx';
89
import OldAPIs from '@/sections/api/old/index.mdx';
910
import TestUtilities from '@/sections/api/test-utils/index.mdx';
1011

12+
export const metadata: Metadata = {
13+
title: 'API Reference',
14+
description: 'API Reference of styled-components',
15+
};
16+
1117
export default function APIPage() {
1218
return (
13-
<DocsLayout title="API Reference" description="API Reference of styled-components">
19+
<DocsLayout title="API Reference">
1420
<Primary />
1521
<Helpers />
1622
<TestUtilities />
1723
<SupportedCSS />
1824
<TypeScript />
1925
<OldAPIs />
20-
<NextPage href="/docs/tooling" title="Tooling" />
26+
<DocsPageNav current="api" />
2127
</DocsLayout>
2228
);
2329
}

0 commit comments

Comments
 (0)