@codecademy/styleguide 79.1.0-alpha.e84769.0 → 79.2.0-alpha.46f13d.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/preview.ts +17 -1
- package/.storybook/theming/GamutThemeProvider.tsx +4 -0
- package/CHANGELOG.md +7 -1
- package/package.json +2 -2
- package/src/lib/Atoms/Badge/Badge.mdx +1 -1
- package/src/lib/Meta/About.mdx +2 -0
- package/src/lib/Meta/MCP/About.mdx +29 -0
- package/src/lib/Meta/MCP/Code Connect.mdx +38 -0
- package/src/lib/Meta/MCP/Figma MCP.mdx +89 -0
- package/src/lib/Molecules/Alert/Alert.mdx +1 -1
- package/src/static/mcp/component_playground.png +0 -0
- package/src/static/mcp/component_with_code_connect.png +0 -0
package/.storybook/preview.ts
CHANGED
|
@@ -46,11 +46,15 @@ const preview: Preview = {
|
|
|
46
46
|
[
|
|
47
47
|
'About',
|
|
48
48
|
'Best Practices',
|
|
49
|
-
'ESLint rules',
|
|
50
49
|
'Contributing',
|
|
50
|
+
'ESLint rules',
|
|
51
51
|
'FAQs',
|
|
52
52
|
'Logical and physical CSS properties',
|
|
53
53
|
'Stories',
|
|
54
|
+
'Brand',
|
|
55
|
+
'Installation',
|
|
56
|
+
'Usage Guide',
|
|
57
|
+
'MCP',
|
|
54
58
|
],
|
|
55
59
|
'Foundations',
|
|
56
60
|
'Layouts',
|
|
@@ -177,6 +181,18 @@ export const globalTypes = {
|
|
|
177
181
|
showName: true,
|
|
178
182
|
},
|
|
179
183
|
},
|
|
184
|
+
direction: {
|
|
185
|
+
name: 'Direction',
|
|
186
|
+
description: 'Text direction for the page',
|
|
187
|
+
defaultValue: 'ltr',
|
|
188
|
+
toolbar: {
|
|
189
|
+
items: [
|
|
190
|
+
{ value: 'ltr', icon: 'arrowright', title: 'Left-To-Right' },
|
|
191
|
+
{ value: 'rtl', icon: 'arrowleft', title: 'Right-To-Left' },
|
|
192
|
+
],
|
|
193
|
+
showName: true,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
180
196
|
};
|
|
181
197
|
|
|
182
198
|
export const decorators = [withEmotion];
|
|
@@ -35,6 +35,7 @@ type GlobalsContext = {
|
|
|
35
35
|
colorMode: 'light' | 'dark';
|
|
36
36
|
theme: keyof typeof themeMap;
|
|
37
37
|
logicalProps: 'true' | 'false';
|
|
38
|
+
direction: 'ltr' | 'rtl';
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
|
|
@@ -42,6 +43,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
42
43
|
const colorMode = context.globals.colorMode ?? 'light';
|
|
43
44
|
const selectedTheme = context.globals.theme;
|
|
44
45
|
const useLogicalProperties = context.globals.logicalProps !== 'false';
|
|
46
|
+
const direction = context.globals.direction ?? 'ltr';
|
|
45
47
|
const background = corePalette[themeBackground[colorMode]];
|
|
46
48
|
const storyRef = useRef<HTMLDivElement>(null);
|
|
47
49
|
const currentTheme = themeMap[selectedTheme];
|
|
@@ -66,6 +68,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
66
68
|
alwaysSetVariables
|
|
67
69
|
bg={themeBackground[colorMode]}
|
|
68
70
|
ref={storyRef}
|
|
71
|
+
dir={direction}
|
|
69
72
|
>
|
|
70
73
|
{Story()}
|
|
71
74
|
</Background>
|
|
@@ -83,6 +86,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
83
86
|
alwaysSetVariables
|
|
84
87
|
bg={themeBackground[colorMode]}
|
|
85
88
|
ref={storyRef}
|
|
89
|
+
dir={direction}
|
|
86
90
|
>
|
|
87
91
|
{Story()}
|
|
88
92
|
</Background>
|
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,19 @@
|
|
|
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.
|
|
6
|
+
## [79.2.0-alpha.46f13d.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.0...@codecademy/styleguide@79.2.0-alpha.46f13d.0) (2026-02-09)
|
|
7
7
|
|
|
8
8
|
### Features
|
|
9
9
|
|
|
10
10
|
- Add border related logical props ([#3257](https://github.com/Codecademy/gamut/issues/3257)) ([e852afa](https://github.com/Codecademy/gamut/commit/e852afa6b0f70eb0e3a696c2b0fde7be0047bd5b))
|
|
11
11
|
- Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([567a6ae](https://github.com/Codecademy/gamut/commit/567a6aeffb3e8628db4b5c9a37dab965b716d969))
|
|
12
12
|
|
|
13
|
+
## [79.1.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.1.0) (2026-02-09)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- Figma CodeConnect and MCP documentation and enablement ([7236a27](https://github.com/Codecademy/gamut/commit/7236a27ecc88eb6794049f06928e6c573213ae60))
|
|
18
|
+
|
|
13
19
|
## [79.0.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@78.5.5...@codecademy/styleguide@79.0.0) (2026-01-29)
|
|
14
20
|
|
|
15
21
|
### ⚠ BREAKING CHANGES
|
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.
|
|
4
|
+
"version": "79.2.0-alpha.46f13d.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": "1c26194c40c6e1a1e8b919631d7d5831647e819f"
|
|
12
12
|
}
|
|
@@ -124,7 +124,7 @@ Use `sm` when the `Badge` is inline with other components such as <LinkTo id='Ty
|
|
|
124
124
|
|
|
125
125
|
## Leading icon
|
|
126
126
|
|
|
127
|
-
Include the `icon` property when the icon reinforces the badge
|
|
127
|
+
Include the `icon` property when the icon reinforces the badge's message and improves scannability. Since badges are inherently small, it's recommended to use Gamut's mini icons. Below are examples of using icons with the different `Badge` sizes.
|
|
128
128
|
|
|
129
129
|
### Default size with icon
|
|
130
130
|
|
package/src/lib/Meta/About.mdx
CHANGED
|
@@ -14,6 +14,7 @@ import { parameters as eslintRulesParameters } from './ESLint rules.mdx';
|
|
|
14
14
|
import { parameters as faqsParameters } from './FAQs.mdx';
|
|
15
15
|
import { parameters as installationParameters } from './Installation.mdx';
|
|
16
16
|
import { parameters as logicalPhysicalParameters } from './Logical and physical CSS properties.mdx';
|
|
17
|
+
import { parameters as mcpAboutParameters } from './MCP/About.mdx';
|
|
17
18
|
import { parameters as storiesParameters } from './Stories.mdx';
|
|
18
19
|
import { parameters as usageGuideParameters } from './Usage Guide.mdx';
|
|
19
20
|
|
|
@@ -40,5 +41,6 @@ export const parameters = {
|
|
|
40
41
|
storiesParameters,
|
|
41
42
|
brandParameters,
|
|
42
43
|
usageGuideParameters,
|
|
44
|
+
mcpAboutParameters,
|
|
43
45
|
])}
|
|
44
46
|
/>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AboutHeader,
|
|
5
|
+
addParentPath,
|
|
6
|
+
TableOfContents,
|
|
7
|
+
} from '~styleguide/blocks';
|
|
8
|
+
|
|
9
|
+
import { parameters as codeConnectParameters } from './Code Connect.mdx';
|
|
10
|
+
import { parameters as figmaMcpParameters } from './Figma MCP.mdx';
|
|
11
|
+
|
|
12
|
+
export const parameters = {
|
|
13
|
+
id: 'Meta/MCP',
|
|
14
|
+
title: 'MCP',
|
|
15
|
+
subtitle:
|
|
16
|
+
'Documentation related to the Figma Model Context Protocol exclusive to Codecademy + Skillsoft employees.',
|
|
17
|
+
status: 'static',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
<Meta title="Meta/MCP/About" />
|
|
21
|
+
|
|
22
|
+
<AboutHeader {...parameters} />
|
|
23
|
+
|
|
24
|
+
<TableOfContents
|
|
25
|
+
links={addParentPath(parameters.id, [
|
|
26
|
+
codeConnectParameters,
|
|
27
|
+
figmaMcpParameters,
|
|
28
|
+
])}
|
|
29
|
+
/>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { AboutHeader, Callout, ImageWrapper } from '~styleguide/blocks';
|
|
4
|
+
|
|
5
|
+
export const parameters = {
|
|
6
|
+
id: 'Code Connect',
|
|
7
|
+
title: 'Code Connect',
|
|
8
|
+
subtitle: 'Exploring Code Connect features in Figma.',
|
|
9
|
+
status: 'static',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
<Meta title="Meta/MCP/Code Connect" />
|
|
13
|
+
|
|
14
|
+
<AboutHeader {...parameters} />
|
|
15
|
+
|
|
16
|
+
Code Connect provides Figma with the actual code for Figma components. In providing accurate code, this helps the Figma MCP generate accurate code snippets for designs that use these components.
|
|
17
|
+
|
|
18
|
+
More information can be found at [Figma Code Connect documentation](https://www.figma.com/code-connect-docs/)
|
|
19
|
+
|
|
20
|
+
<Callout text="Any changes to Code Connect files should be requested through the Gamut team and NOT done on an individual or a separate team." />
|
|
21
|
+
|
|
22
|
+
## Code Connected components
|
|
23
|
+
|
|
24
|
+
When visiting the Figma file, you'll know if a component is set up with Code Connect if you select the component and see the sidebar includes a "Code Connect" section.
|
|
25
|
+
|
|
26
|
+
<ImageWrapper
|
|
27
|
+
src="./mcp/component_with_code_connect.png"
|
|
28
|
+
alt="A Figma component, Badge, with the Code Connect sidebar open."
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
### Exploring behavior
|
|
32
|
+
|
|
33
|
+
For components with Code Connect, you can also click on the "Explore behavior" button to open a modal that allows you to edit the component's props. Editing these props will automatically update the code in the modal's Code Connect section to give you a sense of how to adapt your component accordingly.
|
|
34
|
+
|
|
35
|
+
<ImageWrapper
|
|
36
|
+
src="./mcp/component_playground.png"
|
|
37
|
+
alt="The 'Component playground' modal, with the Badge component's props editable."
|
|
38
|
+
/>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { AboutHeader, Callout } from '~styleguide/blocks';
|
|
4
|
+
|
|
5
|
+
export const parameters = {
|
|
6
|
+
id: 'Figma MCP',
|
|
7
|
+
title: 'Figma MCP',
|
|
8
|
+
subtitle:
|
|
9
|
+
'Set up the Figma MCP locally to enable design to code generation, exclusive to Codecademy + Skillsoft employees.',
|
|
10
|
+
status: 'static',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
<Meta title="Meta/MCP/Figma MCP" />
|
|
14
|
+
|
|
15
|
+
<AboutHeader {...parameters} />
|
|
16
|
+
|
|
17
|
+
<Callout text="Any MCP generated code is EXPERIMENTAL! You should always validate the code generated and adapt it to your own needs — do NOT simply use the MCP to generate code and push it to production! Additionally, you must have a Dev or Full account to be able to be able to use the Figma MCP." />
|
|
18
|
+
|
|
19
|
+
The offical guidance and documentation comes from Figma. Please reference [Figma Dev Mode MCP documentation](https://help.figma.com/hc/en-us/articles/32132100833559-Guide-to-the-Dev-Mode-MCP-Server) for the most up to date information. This documentation below has been adapted to fit the context of the Gamut repository.
|
|
20
|
+
|
|
21
|
+
## Figma (desktop client app)
|
|
22
|
+
|
|
23
|
+
Go to [Figma's download page](https://www.figma.com/downloads/) to download the appropriate version of the Figma desktop client for your OS.
|
|
24
|
+
|
|
25
|
+
### Start up local Figma MCP server
|
|
26
|
+
|
|
27
|
+
1. In the Figma desktop client, check that you have dev mode enabled.
|
|
28
|
+
2. The right-hand sidebar should have a "MCP server" section
|
|
29
|
+
3. Click on the "Open settings modal" button
|
|
30
|
+
4. In the modal, toggle the status to "On", the the color of the toggle should be green.
|
|
31
|
+
OR
|
|
32
|
+
5. Click on the Figma icon in the top left-hand corner and select "Actions"
|
|
33
|
+
6. Type "Enable desktop MCP server"
|
|
34
|
+
7. Click on the checkbox, if it's not already checked, to enable the MCP server.
|
|
35
|
+
|
|
36
|
+
## Set up MCP Client for your text editor/IDE
|
|
37
|
+
|
|
38
|
+
We currently support Figma MCP for Cursor. Please let the Gamut team know if you'd like support for other editors.
|
|
39
|
+
|
|
40
|
+
### Cursor
|
|
41
|
+
|
|
42
|
+
1. Open **Cursor** → **Settings** → **Cursor Settings**.
|
|
43
|
+
2. Go to the **MCP** tab (might be called **MCP & Integrations**) from the left-hand sidebar.
|
|
44
|
+
3. Under **MCP Tools**, click **+ Add MCP server**.
|
|
45
|
+
4. Enter the following configuration and save:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"Figma": {
|
|
51
|
+
"url": "http://127.0.0.1:3845/mcp"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Verify your MCP server is running
|
|
58
|
+
|
|
59
|
+
To check if your MCP server is running, you can visit the endpoint: `http://127.0.0.1:3845/mcp`. You should see a response, e.g.: `{"jsonrpc":"2.0","error":{"code":-32001,"message":"Invalid sessionId"},"id":null}`.
|
|
60
|
+
Yes, it's an odd response, but it indicates that the MCP server is running — otherwise if it's not running you'll see an error "This site can’t be reached" on the page.
|
|
61
|
+
|
|
62
|
+
Similarly you can test the end point using:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl http://127.0.0.1:3845/mcp
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Prompt your MCP client
|
|
69
|
+
|
|
70
|
+
You can prompt the MCP in two main ways:
|
|
71
|
+
|
|
72
|
+
1. Provide a link to the node of the design you'd like to generate code for, e.g.:
|
|
73
|
+
|
|
74
|
+
> Generate the code for this node: https://www.figma.com/design/ReGfRNillGABAj5SlITalN/%F0%9F%93%90-Gamut?node-id=79202-13690&m=dev
|
|
75
|
+
|
|
76
|
+
2. Selecting the node in the Figma interface, e.g.:
|
|
77
|
+
> Generate the code for the current selection
|
|
78
|
+
|
|
79
|
+
In the chat, you may be prompted to allow the Figma commands like `get_code()` to run. You can also add these commands to an allow list in your code editor's settings.
|
|
80
|
+
|
|
81
|
+
## Feedback for the Gamut team
|
|
82
|
+
|
|
83
|
+
Please let the Gamut team of any feedback you have, things like:
|
|
84
|
+
|
|
85
|
+
- If you find that a new rule that you'd like implemented in this repo, please let the Gamut team know.
|
|
86
|
+
- Support for another text editor/IDE.
|
|
87
|
+
- Incorrect code generation
|
|
88
|
+
|
|
89
|
+
If you have any other feedback or suggestions, feel free to share those as well!
|
|
@@ -62,7 +62,7 @@ Use an alert to display an important, succinct message with actions for users to
|
|
|
62
62
|
4. Dismiss button (optional)
|
|
63
63
|
|
|
64
64
|
- Use to allow users to remove the alert after they've acknowledged it or when it's no longer needed
|
|
65
|
-
- Only exclude when the information must remain visible until specific conditions are met to ensure users don
|
|
65
|
+
- Only exclude when the information must remain visible until specific conditions are met to ensure users don't miss critical information
|
|
66
66
|
|
|
67
67
|
## Variants
|
|
68
68
|
|
|
Binary file
|
|
Binary file
|