Skip to content

Commit 9c54c12

Browse files
major: v2 (#2)
* fix: security auditing * feat: implement level grouping (#13) * feat: implement level grouping * chore: some content changes * feat: implement the plymorphic lesson (#37) * feat: implement state colocation + state lifting (#38) * feat: implement the state lifting & colocation pattern * chore: update some copy * fix: build * fix: button colours * fix: ai fixes (#41) * fix: audit issues (#43) * feat: error boundary issue (#42) * feat: rebrand conditional rendering and update titles (#44) * feat: change conditional rendering to be pokemon themed * chore: update all stories * chore: update error boundary * feat: rebrand props combination pattern (#45) * feat: implement react hooks rebrand (#46) * feat: implement slots rebranded * feat: implement the compound pattern in pokemon style * feat: implement pokemone controlled component version * feat: implement portals pokemon style * feat: implement pokemon style for poly components * feat: implement render props pokemon pattern * feat: implement the render children pattern * feat: implement the FACC * feat: implement uncontrolled components * feat: implement suspense * feat: implement the headless component pattern * feat: improve the HOC lesson * chore: update some files * chore: tidy up config * docs: update reamde * feat: implement better landing page * fix: pipelines * fix: styling on landing page
1 parent 3682d57 commit 9c54c12

File tree

214 files changed

+15558
-9105
lines changed

Some content is hidden

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

214 files changed

+15558
-9105
lines changed

.github/workflows/main.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Quality checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- feature/**
8+
- v2
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
quality_checks:
15+
name: Quality checks
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
shard: [1]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Cache
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.npm
30+
${{ github.workspace }}/dist/cache
31+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
32+
restore-keys: |
33+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
34+
35+
- name: Setup Node.js environment
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 20
39+
40+
- name: Install
41+
run: npm ci --force
42+
43+
- name: Security Audit Checks
44+
run: npm run audit
45+
46+
- name: Static testing
47+
run: npm run lint
48+
49+
- name: Build Website
50+
run: npm run build
51+
52+
- name: Build Storybook
53+
run: npm run build-storybook

.storybook/components/CodeBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { CodeBlock, shadesOfPurple } from 'react-code-blocks';
33

4-
export const Code = ({ children }) => (
4+
export const Code = ({ children }: { children: string }) => (
55
<CodeBlock
66
text={children}
77
language="jsx"

.storybook/main.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { StorybookConfig } from '@storybook/react-vite';
22
import { mergeConfig } from 'vite';
3+
import remarkGfm from 'remark-gfm';
4+
import path from 'path';
35

46
const config: StorybookConfig = {
57
stories: [
@@ -10,7 +12,17 @@ const config: StorybookConfig = {
1012
'@storybook/addon-onboarding',
1113
'@storybook/addon-links',
1214
'@storybook/addon-interactions',
13-
'@storybook/addon-essentials'
15+
'@storybook/addon-essentials',
16+
{
17+
name: '@storybook/addon-docs',
18+
options: {
19+
mdxPluginOptions: {
20+
mdxCompileOptions: {
21+
remarkPlugins: [remarkGfm]
22+
}
23+
}
24+
}
25+
}
1426
],
1527
framework: {
1628
name: '@storybook/react-vite',
@@ -27,7 +39,12 @@ const config: StorybookConfig = {
2739
},
2840
async viteFinal(baseConfig, { configType }) {
2941
return mergeConfig(baseConfig, {
30-
...(configType === 'PRODUCTION' ? { base: '/storybook/' } : {})
42+
...(configType === 'PRODUCTION' ? { base: '/storybook/' } : {}),
43+
resolve: {
44+
alias: {
45+
'@shared': path.resolve(__dirname, '../src', 'shared')
46+
}
47+
}
3148
});
3249
}
3350
};

.storybook/manager.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ const theme = create({
99
fontCode: 'monospace',
1010

1111
brandTitle: '⚛️ React Design Patterns',
12-
brandUrl: 'https://example.com',
13-
brandTarget: '_self',
14-
//
15-
colorPrimary: '#ffffff',
16-
colorSecondary: '#A599E9',
17-
18-
// UI
19-
appBg: '#1E1E3F',
20-
appContentBg: '#2D2B55',
12+
brandUrl:
13+
'https://github.com/code-mattclaffey/react-design-patterns',
14+
brandTarget: '_blank',
15+
colorPrimary: '#3b82f6', // blue-500
16+
colorSecondary: '#A599E9', // code-500 from tailwind config
17+
18+
// UI - matching main page blue-950 theme
19+
appBg: '#172554', // blue-950
20+
appContentBg: '#1e3a8a', // blue-900
2121
appPreviewBg: '#ffffff',
22-
appBorderColor: '#2D2B55',
23-
appBorderRadius: 4,
22+
appBorderColor: '#1e40af', // blue-800
23+
appBorderRadius: 8,
2424

25-
// Text colors
25+
// Text colors - matching main page
2626
textColor: '#ffffff',
27-
textInverseColor: '#ffffff',
27+
textInverseColor: '#1e293b', // slate-800
2828

29-
// Toolbar default and active colors
30-
barTextColor: '#ffffff',
29+
// Toolbar colors - matching header
30+
barTextColor: '#cbd5e1', // slate-300
3131
barSelectedColor: '#ffffff',
3232
barHoverColor: '#ffffff',
33-
barBg: '#1E1E3F',
33+
barBg: '#172554', // blue-950
3434

3535
// Form colors
36-
inputBg: '#ffffff',
37-
inputBorder: '#35356b',
38-
inputTextColor: '#1E1E3F',
39-
inputBorderRadius: 2,
40-
41-
// Buttons
42-
buttonBg: '#35356b',
43-
buttonBorder: '#35356b',
36+
inputBg: '#1e40af', // blue-800
37+
inputBorder: '#3b82f6', // blue-500
38+
inputTextColor: '#ffffff',
39+
inputBorderRadius: 6,
40+
41+
// Buttons - matching CTA buttons
42+
buttonBg: '#2563eb', // blue-600
43+
buttonBorder: '#2563eb', // blue-600
4444
gridCellSize: 24
4545
});
4646

.storybook/preview.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ const preview: Preview = {
1212
code: Code
1313
}
1414
},
15-
storySort: ['Introduction', 'Lessons', 'Recipes'],
15+
storySort: [
16+
'Introduction',
17+
'Lessons',
18+
['🥉 Bronze', '🥈 Silver', '🥇 Gold'],
19+
'Recipes'
20+
],
1621
controls: {
1722
matchers: {
1823
color: /(background|color)$/i,

.storybook/styles/docs.styles.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
/* Main content styling to match landing page */
12
.sbdocs-content p,
23
.sbdocs-content li,
34
.sbdocs-content a {
45
font-size: 1.125rem;
56
line-height: 1.6;
7+
font-weight: 500;
68
}
79

810
.sbdocs-content h1,
@@ -14,16 +16,67 @@
1416
font-weight: 700;
1517
font-style: normal;
1618
margin-top: 1.5rem !important;
19+
line-height: 1.2;
1720
}
1821

1922
.sbdocs-content h1 {
2023
font-size: 2.5rem;
24+
color: #1e293b;
2125
}
2226

2327
.sbdocs-content h2 {
2428
font-size: 2rem;
29+
color: #1e293b;
2530
}
2631

2732
.sbdocs-content h3 {
2833
font-size: 1.75rem;
34+
color: #1e293b;
35+
}
36+
37+
.sbdocs-content ol {
38+
list-style: decimal;
39+
}
40+
41+
/* Code blocks styling */
42+
.sbdocs-content pre {
43+
background-color: #172554 !important; /* blue-950 */
44+
border: 1px solid #1e40af; /* blue-800 */
45+
border-radius: 8px;
46+
}
47+
48+
/* Links styling to match main page */
49+
.sbdocs-content a {
50+
color: #3b82f6; /* blue-500 */
51+
text-decoration: none;
52+
transition: color 0.2s ease;
53+
}
54+
55+
.sbdocs-content a:hover {
56+
color: #2563eb; /* blue-600 */
57+
text-decoration: underline;
58+
}
59+
60+
/* Badge/tag styling */
61+
.sbdocs-content .docblock-code-toggle {
62+
background-color: #1e40af; /* blue-800 */
63+
color: white;
64+
border-radius: 6px;
65+
}
66+
67+
/* Table styling */
68+
.sbdocs-content table {
69+
border-collapse: collapse;
70+
border-radius: 8px;
71+
overflow: hidden;
72+
}
73+
74+
.sbdocs-content th {
75+
background-color: #1e40af; /* blue-800 */
76+
color: white;
77+
font-weight: 600;
78+
}
79+
80+
.sbdocs-content td {
81+
border-color: #cbd5e1; /* slate-300 */
2982
}

0 commit comments

Comments
 (0)