@codecademy/styleguide 79.2.4-alpha.38d1e4.0 → 79.2.4-alpha.9ce37a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/components/ImageWrapper.tsx +4 -2
- package/.storybook/preview.ts +2 -22
- package/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/src/lib/Meta/About.mdx +5 -5
- package/src/lib/Meta/{Best practices.mdx → Best Practices.mdx } +3 -3
- package/src/lib/Meta/{Gamut writing guide/Stories/Component story documentation.mdx → Stories.mdx} +85 -19
- package/src/lib/Meta/{Usage guide.mdx → Usage Guide.mdx } +3 -3
- package/src/lib/Molecules/Tips/InfoTip/InfoTip.mdx +1 -1
- package/src/lib/Organisms/BarChart/BarChart.mdx +463 -0
- package/src/lib/Organisms/BarChart/BarChart.stories.tsx +352 -0
- package/src/static/organisms/barchart.png +0 -0
- package/src/lib/Meta/Gamut writing guide/About.mdx +0 -43
- package/src/lib/Meta/Gamut writing guide/Documentation in code.mdx +0 -134
- package/src/lib/Meta/Gamut writing guide/Formatting.mdx +0 -69
- package/src/lib/Meta/Gamut writing guide/General principles.mdx +0 -46
- package/src/lib/Meta/Gamut writing guide/Language and grammar.mdx +0 -54
- package/src/lib/Meta/Gamut writing guide/Linking.mdx +0 -60
- package/src/lib/Meta/Gamut writing guide/Referencing code.mdx +0 -86
- package/src/lib/Meta/Gamut writing guide/Stories/About pages.mdx +0 -49
- package/src/lib/Meta/Gamut writing guide/Stories/About.mdx +0 -57
- package/src/lib/Meta/Gamut writing guide/Stories/Component code examples.mdx +0 -79
- /package/src/lib/Meta/{Deep Controls add-on.mdx → Deep Controls Add-On.mdx} +0 -0
|
@@ -3,8 +3,9 @@ import * as React from 'react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
|
|
5
5
|
interface ImageWrapperProps {
|
|
6
|
-
src: string;
|
|
7
6
|
alt: string;
|
|
7
|
+
height: number | string;
|
|
8
|
+
src: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
const StyledImage = styled.img`
|
|
@@ -15,12 +16,13 @@ const StyledImage = styled.img`
|
|
|
15
16
|
export const ImageWrapper: React.FC<ImageWrapperProps & BoxProps> = ({
|
|
16
17
|
src,
|
|
17
18
|
alt,
|
|
19
|
+
height = '216px',
|
|
18
20
|
...props
|
|
19
21
|
}) => {
|
|
20
22
|
return (
|
|
21
23
|
<Box
|
|
22
24
|
width={'100%'}
|
|
23
|
-
height=
|
|
25
|
+
height={height}
|
|
24
26
|
display="flex"
|
|
25
27
|
justifyContent={'center'}
|
|
26
28
|
alignItems="center"
|
package/.storybook/preview.ts
CHANGED
|
@@ -45,35 +45,15 @@ const preview: Preview = {
|
|
|
45
45
|
'Meta',
|
|
46
46
|
[
|
|
47
47
|
'About',
|
|
48
|
-
'
|
|
49
|
-
'Best practices',
|
|
48
|
+
'Best Practices',
|
|
50
49
|
'Contributing',
|
|
51
|
-
'Deep Controls add-on',
|
|
52
50
|
'ESLint rules',
|
|
53
51
|
'FAQs',
|
|
54
52
|
'Logical and physical CSS properties',
|
|
55
53
|
'Stories',
|
|
56
54
|
'Brand',
|
|
57
55
|
'Installation',
|
|
58
|
-
'
|
|
59
|
-
'Usage guide',
|
|
60
|
-
'Gamut writing guide',
|
|
61
|
-
[
|
|
62
|
-
'About',
|
|
63
|
-
'General principles',
|
|
64
|
-
'Documentation in code',
|
|
65
|
-
'Formatting',
|
|
66
|
-
'Language and grammar',
|
|
67
|
-
'Linking',
|
|
68
|
-
'Referencing code',
|
|
69
|
-
'Stories',
|
|
70
|
-
[
|
|
71
|
-
'About',
|
|
72
|
-
'About pages',
|
|
73
|
-
'Component story documentation',
|
|
74
|
-
'Component code examples',
|
|
75
|
-
],
|
|
76
|
-
],
|
|
56
|
+
'Usage Guide',
|
|
77
57
|
'MCP',
|
|
78
58
|
],
|
|
79
59
|
'Foundations',
|
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [79.2.4-alpha.
|
|
6
|
+
### [79.2.4-alpha.9ce37a.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.2.3...@codecademy/styleguide@79.2.4-alpha.9ce37a.0) (2026-03-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @codecademy/styleguide
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/styleguide",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "79.2.4-alpha.
|
|
4
|
+
"version": "79.2.4-alpha.9ce37a.0",
|
|
5
5
|
"author": "Codecademy Engineering",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"repository": "git@github.com:Codecademy/gamut.git",
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "1d57457aa4e2a2d780bc1b006631a7e82e12e314"
|
|
12
12
|
}
|
package/src/lib/Meta/About.mdx
CHANGED
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
TableOfContents,
|
|
7
7
|
} from '~styleguide/blocks';
|
|
8
8
|
|
|
9
|
-
import { parameters as bestPracticesParameters } from './Best
|
|
9
|
+
import { parameters as bestPracticesParameters } from './Best Practices.mdx';
|
|
10
10
|
import { parameters as brandParameters } from './Brand.mdx';
|
|
11
11
|
import { parameters as contributingParameters } from './Contributing.mdx';
|
|
12
|
-
import { parameters as deepControlsParameters } from './Deep Controls
|
|
12
|
+
import { parameters as deepControlsParameters } from './Deep Controls Add-On.mdx';
|
|
13
13
|
import { parameters as eslintRulesParameters } from './ESLint rules.mdx';
|
|
14
14
|
import { parameters as faqsParameters } from './FAQs.mdx';
|
|
15
|
-
import { parameters as gamutWritingGuideParameters } from './Gamut writing guide/About.mdx';
|
|
16
15
|
import { parameters as installationParameters } from './Installation.mdx';
|
|
17
16
|
import { parameters as logicalPhysicalParameters } from './Logical and physical CSS properties.mdx';
|
|
18
17
|
import { parameters as mcpAboutParameters } from './MCP/About.mdx';
|
|
19
|
-
import { parameters as
|
|
18
|
+
import { parameters as storiesParameters } from './Stories.mdx';
|
|
19
|
+
import { parameters as usageGuideParameters } from './Usage Guide.mdx';
|
|
20
20
|
|
|
21
21
|
export const parameters = {
|
|
22
22
|
id: 'Meta',
|
|
@@ -36,9 +36,9 @@ export const parameters = {
|
|
|
36
36
|
deepControlsParameters,
|
|
37
37
|
eslintRulesParameters,
|
|
38
38
|
faqsParameters,
|
|
39
|
-
gamutWritingGuideParameters,
|
|
40
39
|
installationParameters,
|
|
41
40
|
logicalPhysicalParameters,
|
|
41
|
+
storiesParameters,
|
|
42
42
|
brandParameters,
|
|
43
43
|
usageGuideParameters,
|
|
44
44
|
mcpAboutParameters,
|
|
@@ -3,13 +3,13 @@ import { Meta } from '@storybook/blocks';
|
|
|
3
3
|
import { AboutHeader, Callout } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
export const parameters = {
|
|
6
|
-
id: 'Best
|
|
7
|
-
title: 'Best
|
|
6
|
+
id: 'Best Practices',
|
|
7
|
+
title: 'Best Practices',
|
|
8
8
|
subtitle: 'Current best practices for using the Gamut Design System',
|
|
9
9
|
status: 'current',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
<Meta title="Meta/Best
|
|
12
|
+
<Meta title="Meta/Best Practices" />
|
|
13
13
|
|
|
14
14
|
<AboutHeader {...parameters} />
|
|
15
15
|
|
package/src/lib/Meta/{Gamut writing guide/Stories/Component story documentation.mdx → Stories.mdx}
RENAMED
|
@@ -1,32 +1,67 @@
|
|
|
1
1
|
import { Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
|
-
import { AboutHeader } from '~styleguide/blocks';
|
|
3
|
+
import { AboutHeader, LinkTo } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
export const parameters = {
|
|
6
|
-
id: '
|
|
7
|
-
title: '
|
|
8
|
-
subtitle: '
|
|
6
|
+
id: 'Stories',
|
|
7
|
+
title: 'Stories',
|
|
8
|
+
subtitle: 'Guidelines and tooling for writing Storybook stories and docs.',
|
|
9
9
|
status: 'static',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
<Meta title="Meta/
|
|
12
|
+
<Meta title="Meta/Stories" />
|
|
13
13
|
|
|
14
14
|
<AboutHeader {...parameters} />
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## Quick start
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
We've provided a few helpful vscode snippets to help you get through boilerplate. To use these start to type these strings in your editor and pick the template and fill out the tab targets.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
- `component-story`: The default TSX story template.
|
|
21
|
+
- `component-doc`: The default component documentation template - each component should have a `.tsx` and `.mdx` file.
|
|
22
|
+
- `toc-story`: A simple template for a Table of Contents category page.
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
## File structure and naming
|
|
25
|
+
|
|
26
|
+
When you make a new story theres a few things to keep in mind:
|
|
27
|
+
|
|
28
|
+
- The folder structure is indicative of our flavor of atomic design.
|
|
29
|
+
- The folder struture is identical to the storybook hierarchy generated.
|
|
30
|
+
|
|
31
|
+
First find the right folder for your story in `packages/styleguide/stories` (e.g. `Atoms` | `Molecules` | `Organisms`).
|
|
32
|
+
Once you've found it create a new folder with two new files `#{COMPONENT_NAME}.stories.tsx` and `#{COMPONENT_NAME}.mdx`. You can also store examples or other associated utility files in this folder.
|
|
33
|
+
|
|
34
|
+
In your new files you can use the above snippets to set up your component add:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// For ComponentName.stories.tsx
|
|
38
|
+
|
|
39
|
+
import { ComponentName } from '@codecademy/gamut';
|
|
40
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
41
|
+
|
|
42
|
+
const meta: Meta<typeof ComponentName> = {
|
|
43
|
+
component: ComponentName,
|
|
44
|
+
args: {
|
|
45
|
+
variant: 'default',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
export default meta;
|
|
50
|
+
type Story = StoryObj<typeof ComponentName>;
|
|
28
51
|
|
|
29
|
-
|
|
52
|
+
export const Default: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
children: <img src="./cinna.jpg" alt="jpeg" />,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Secondary: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
children: 'Pro Content',
|
|
61
|
+
variant: 'secondary',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
```
|
|
30
65
|
|
|
31
66
|
```tsx
|
|
32
67
|
// For ComponentName.mdx, more details in the component-doc code snippet
|
|
@@ -62,9 +97,16 @@ export const parameters = {
|
|
|
62
97
|
Etc...
|
|
63
98
|
```
|
|
64
99
|
|
|
65
|
-
##
|
|
100
|
+
## Story structure
|
|
66
101
|
|
|
67
|
-
|
|
102
|
+
In our opinion, a good component story page consists of:
|
|
103
|
+
|
|
104
|
+
1. **General Information:** Each component should define some key information on the `<Meta />` component
|
|
105
|
+
2. **Flagship Story + Props:** A single default story showing the default state of the component with a connected props table right below it.
|
|
106
|
+
3. **Variation Stories:** Granular subsections that show the discrete varaitions of the component and describe their use cases
|
|
107
|
+
4. **Usage instructions and Guidelines:** A section that describes how to use the component should and shouldn't be used, and any guidelines that should be followed.
|
|
108
|
+
|
|
109
|
+
### General information
|
|
68
110
|
|
|
69
111
|
1. `title`: The name of the component, this helps with linking to the story.
|
|
70
112
|
2. `subtitle`: What the component does, and what the component would typically be used for.
|
|
@@ -99,9 +141,9 @@ export const parameters = {
|
|
|
99
141
|
|
|
100
142
|
```
|
|
101
143
|
|
|
102
|
-
|
|
144
|
+
### Flagship story
|
|
103
145
|
|
|
104
|
-
The Flagship story for a component should be intended to give the reader a broad overview of its high-level functionality. Its `Canvas` should automatically display the story's code by setting the prop
|
|
146
|
+
The Flagship story for a component should be intended to give the reader a broad overview of its high-level functionality. Its `Canvas` should automatically display the story's code by setting the prop sourceState="shown".
|
|
105
147
|
|
|
106
148
|
Try to include the major behaviors for the component that most readers would need to understand its uses.
|
|
107
149
|
|
|
@@ -114,7 +156,7 @@ Try to include the major behaviors for the component that most readers would nee
|
|
|
114
156
|
<Controls />
|
|
115
157
|
```
|
|
116
158
|
|
|
117
|
-
|
|
159
|
+
### Granular stories
|
|
118
160
|
|
|
119
161
|
Each subsequent story should elaborate on an important behavioral feature of the component.
|
|
120
162
|
Try to show a single use of the behavior configurable with args.
|
|
@@ -127,3 +169,27 @@ A short description should go here, as well as any variant specific usage guidel
|
|
|
127
169
|
<Canvas of={AnchorStories.Variant} />
|
|
128
170
|
|
|
129
171
|
```
|
|
172
|
+
|
|
173
|
+
### About pages
|
|
174
|
+
|
|
175
|
+
An `About.mdx` file should be be included when multiple stories are presented in a folder. E.g. the <LinkTo id="Atoms/Animations/About">Animation</LinkTo> folder which contains an `About.mdx` file with a table of contents that link to specific components -- in this case, the <LinkTo id="Atoms/Animations/ExpandInCollapseOut">ExpandInCollapseOut</LinkTo> component and the <LinkTo id="Atoms/Animations/Rotation">Rotation</LinkTo> component.
|
|
176
|
+
|
|
177
|
+
Inside the `About.mdx` file, import the `parameters` object from the respective component's `<ComponentName>.mdx` file and pass it to the `<TableOfContents />` component.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { parameters as componentNameParameters } from './ComponentName.mdx';
|
|
181
|
+
import { parameters as anotherComponentParameters } from './AnotherComponent.mdx';
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
export const parameters = {
|
|
185
|
+
id: 'ParentDir/FolderName',
|
|
186
|
+
title: 'FolderName',
|
|
187
|
+
subtitle: 'Overview of the components in this folder.',
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
...
|
|
191
|
+
|
|
192
|
+
<TableOfContents links={addParentPath(parameters.id, [componentNameParameters, anotherComponentParameters]))} />
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The `addParentPath` function is used to ensure that the links in the table of contents have the correct IDs, which are derived from the parent path and the component's ID or title.
|
|
@@ -3,14 +3,14 @@ import { Meta } from '@storybook/blocks';
|
|
|
3
3
|
import { AboutHeader, Callout, ImageWrapper, LinkTo } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
export const parameters = {
|
|
6
|
-
id: 'Usage
|
|
7
|
-
title: 'Usage
|
|
6
|
+
id: 'Usage Guide',
|
|
7
|
+
title: 'Usage Guide',
|
|
8
8
|
subtitle:
|
|
9
9
|
'Tips and tricks to using the Gamut Storybook as a user and developer.',
|
|
10
10
|
status: 'static',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
<Meta title="Meta/Usage
|
|
13
|
+
<Meta title="Meta/Usage Guide" />
|
|
14
14
|
|
|
15
15
|
<AboutHeader {...parameters} />
|
|
16
16
|
|
|
@@ -11,7 +11,7 @@ export const parameters = {
|
|
|
11
11
|
type: 'figma',
|
|
12
12
|
url: 'https://www.figma.com/file/ReGfRNillGABAj5SlITalN/branch/ayKNSg6QvZUjsgw0FFysW4/%F0%9F%93%90-Gamut?type=design&node-id=41538-55277&mode=design&t=fGkWf5GSl5cj5fQo-0',
|
|
13
13
|
},
|
|
14
|
-
status: '
|
|
14
|
+
status: 'current',
|
|
15
15
|
source: {
|
|
16
16
|
repo: 'gamut',
|
|
17
17
|
githubLink:
|