@codecademy/styleguide 79.1.0-alpha.e84769.0 → 79.1.1-alpha.26b7a6.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/Elements/DocsContainer.tsx +0 -4
- package/.storybook/components/Elements/ImageGallery.tsx +1 -1
- package/.storybook/components/Elements/Markdown.tsx +1 -0
- package/.storybook/preview.ts +5 -15
- package/.storybook/theming/GamutThemeProvider.tsx +1 -7
- package/CHANGELOG.md +6 -3
- package/package.json +2 -2
- package/src/lib/Atoms/Animations/ExpandInCollapseOut/ExpandInCollapseOut.stories.tsx +1 -1
- package/src/lib/Atoms/Animations/FadeInSlideOut/FadeInSlideOut.stories.tsx +1 -1
- package/src/lib/Atoms/Badge/Badge.mdx +1 -1
- package/src/lib/Foundations/System/About.mdx +1 -1
- package/src/lib/Foundations/System/Props.mdx +230 -0
- package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.mdx +3 -3
- package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.stories.tsx +0 -1
- package/src/lib/Foundations/shared/elements.tsx +19 -69
- package/src/lib/Meta/About.mdx +3 -3
- package/src/lib/Meta/ESLint rules.mdx +1 -1
- 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/Meta/Usage Guide.mdx +1 -6
- 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/src/static/meta/toolbar.png +0 -0
- package/src/lib/Foundations/System/Props/About.mdx +0 -81
- package/src/lib/Foundations/System/Props/Background.mdx +0 -30
- package/src/lib/Foundations/System/Props/Border.mdx +0 -53
- package/src/lib/Foundations/System/Props/Border.stories.tsx +0 -138
- package/src/lib/Foundations/System/Props/Color.mdx +0 -42
- package/src/lib/Foundations/System/Props/Color.stories.tsx +0 -47
- package/src/lib/Foundations/System/Props/Flex.mdx +0 -28
- package/src/lib/Foundations/System/Props/Grid.mdx +0 -31
- package/src/lib/Foundations/System/Props/Layout.mdx +0 -34
- package/src/lib/Foundations/System/Props/List.mdx +0 -38
- package/src/lib/Foundations/System/Props/Positioning.mdx +0 -29
- package/src/lib/Foundations/System/Props/Shadow.mdx +0 -31
- package/src/lib/Foundations/System/Props/Space.mdx +0 -44
- package/src/lib/Foundations/System/Props/Space.stories.tsx +0 -48
- package/src/lib/Foundations/System/Props/Typography.mdx +0 -28
- package/src/lib/Meta/Logical and physical CSS properties.mdx +0 -123
|
@@ -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!
|
|
@@ -39,8 +39,7 @@ On each page is a toolbar located on the top:
|
|
|
39
39
|
1. Grid (the 2x2 collection of squares) - applies a grid to the preview
|
|
40
40
|
2. Color mode selector (the circle icon) - toggles between light and dark mode for rendered code examples
|
|
41
41
|
3. Theme switcher (the paintbrush icon) - switches between different design system themes (Core, Admin, LX Studio, Percipio)
|
|
42
|
-
4.
|
|
43
|
-
5. Outline (dotted square) - applies outlines to elements in the rendered code examples
|
|
42
|
+
4. Outline (dotted square) - applies outlines to elements in the rendered code examples
|
|
44
43
|
|
|
45
44
|
### Theme Switcher
|
|
46
45
|
|
|
@@ -59,10 +58,6 @@ Available themes:
|
|
|
59
58
|
|
|
60
59
|
The theme switcher works in combination with the color mode selector, so you can test both light and dark variants of each theme.
|
|
61
60
|
|
|
62
|
-
### LogicalProps
|
|
63
|
-
|
|
64
|
-
The LogicalProps button (two arrows icon) provides a menu to select between Logical and Physical CSS properties.
|
|
65
|
-
|
|
66
61
|
### Showing code
|
|
67
62
|
|
|
68
63
|
On the bottom right of each canvas (a rendered code example) is a button to show its code:
|
|
@@ -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
|
|
Binary file
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AboutHeader,
|
|
5
|
-
addParentPath,
|
|
6
|
-
TableOfContents,
|
|
7
|
-
} from '~styleguide/blocks';
|
|
8
|
-
|
|
9
|
-
import { parameters as backgroundParameters } from './Background.mdx';
|
|
10
|
-
import { parameters as borderParameters } from './Border.mdx';
|
|
11
|
-
import { parameters as colorParameters } from './Color.mdx';
|
|
12
|
-
import { parameters as flexParameters } from './Flex.mdx';
|
|
13
|
-
import { parameters as gridParameters } from './Grid.mdx';
|
|
14
|
-
import { parameters as layoutParameters } from './Layout.mdx';
|
|
15
|
-
import { parameters as listParameters } from './List.mdx';
|
|
16
|
-
import { parameters as positioningParameters } from './Positioning.mdx';
|
|
17
|
-
import { parameters as shadowParameters } from './Shadow.mdx';
|
|
18
|
-
import { parameters as spaceParameters } from './Space.mdx';
|
|
19
|
-
import { parameters as typographyParameters } from './Typography.mdx';
|
|
20
|
-
|
|
21
|
-
export const parameters = {
|
|
22
|
-
id: 'Foundations/System/Props',
|
|
23
|
-
title: 'Props',
|
|
24
|
-
subtitle:
|
|
25
|
-
'Reusable CSS-in-JS props with predictable behaviors and a consistent API for responsive CSS.',
|
|
26
|
-
status: 'current',
|
|
27
|
-
source: {
|
|
28
|
-
repo: 'gamut-styles',
|
|
29
|
-
githubLink:
|
|
30
|
-
'https://github.com/Codecademy/gamut/blob/main/packages/gamut-styles/src/variance/config.ts',
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
<Meta title="Foundations/System/Props/About" />
|
|
35
|
-
|
|
36
|
-
<AboutHeader {...parameters} />
|
|
37
|
-
|
|
38
|
-
We provide a set of out of style functions out of the box through `@codecademy/gamut-styles` that are standardized throughout all of our components. These props are strongly typed and can be included as necessary on any styled component.
|
|
39
|
-
|
|
40
|
-
System props have a few facets that are important to note:
|
|
41
|
-
|
|
42
|
-
- They can some times represent multiple properties.
|
|
43
|
-
- They may be restricted to specific token scales but will always have access to global css values like `initial` and `none`.
|
|
44
|
-
- They may have a function that transforms the given value into a standardized value (e.g. `width={.5}` => `width: 50%`)
|
|
45
|
-
|
|
46
|
-
We've grouped these into a few main groups that affect simliar behaviors: `layout`, `space`, `color`, `border`, `background`, `typography`, `positioning`, `grid`, `flex`, `shadow`.
|
|
47
|
-
|
|
48
|
-
You may import these groups directly from `gamut-styles`.
|
|
49
|
-
|
|
50
|
-
```tsx
|
|
51
|
-
import { variance } from '@codecademy/variance';
|
|
52
|
-
import { system } from '@codecademy/gamut-styles';
|
|
53
|
-
|
|
54
|
-
const ExampleContainer = styled.div(
|
|
55
|
-
variance.compose(system.layout, system.positioning)
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
<ExampleContainer position="absolute" width="50px" height="50px" />;
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Each system prop has 3 important features:
|
|
62
|
-
|
|
63
|
-
- `properties`: Any number of CSS Properties this prop is responsible for.
|
|
64
|
-
- `scale`: A set of values that determines valid inputs for each prop based on the selected theme and that theme's typing (e.g. if the `lxStudio` theme is being used, a scale of `colors` will restrict to the `lxStudio` theme's colors). These are generally aliases for more verbose or opaque CSS properties allowing you to specify a human readable name in your props. If a prop doesn't have a scale that means it accepts all valid `CSSType` values as props, however if it does have a scale it will only accept global values and keys of the provided scale.
|
|
65
|
-
- `transform`: A function that changes the prop / scale value prior to adding it to the stylehseet. This allows us to add / change units for properties like `width` and `height`. Or ensure extra defaults or fallbacks are added dynamically.
|
|
66
|
-
|
|
67
|
-
<TableOfContents
|
|
68
|
-
links={addParentPath(parameters.id, [
|
|
69
|
-
layoutParameters,
|
|
70
|
-
spaceParameters,
|
|
71
|
-
typographyParameters,
|
|
72
|
-
colorParameters,
|
|
73
|
-
borderParameters,
|
|
74
|
-
flexParameters,
|
|
75
|
-
gridParameters,
|
|
76
|
-
backgroundParameters,
|
|
77
|
-
positioningParameters,
|
|
78
|
-
shadowParameters,
|
|
79
|
-
listParameters,
|
|
80
|
-
])}
|
|
81
|
-
/>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
4
|
-
|
|
5
|
-
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
-
|
|
7
|
-
export const parameters = {
|
|
8
|
-
title: 'Background',
|
|
9
|
-
subtitle:
|
|
10
|
-
'Props for background manipulation (sizing / repitition / images), for background color see `colors`.',
|
|
11
|
-
status: 'current',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
<Meta title="Foundations/System/Props/Background" />
|
|
15
|
-
|
|
16
|
-
<AboutHeader {...parameters} />
|
|
17
|
-
|
|
18
|
-
Background props control how background images and patterns are displayed on elements. These properties give you control over image sizing, positioning, and repetition behavior. For solid background colors, use the color props which connect to the theme's color palette.
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import styled from '@emotion/styled';
|
|
22
|
-
import { system } from '@codecademy/gamut-styles';
|
|
23
|
-
import myBg from './myBg.png';
|
|
24
|
-
|
|
25
|
-
const BackgroundExample = styled.div(system.background);
|
|
26
|
-
|
|
27
|
-
<BackgroundExample background={`url(${myBg}`} backgroundSize="cover" />;
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
<TokenTable rows={getPropRows('background')} columns={defaultColumns} />
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
|
|
4
|
-
|
|
5
|
-
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
-
import * as BorderStories from './Border.stories';
|
|
7
|
-
|
|
8
|
-
export const parameters = {
|
|
9
|
-
title: 'Border',
|
|
10
|
-
subtitle: 'Border styles',
|
|
11
|
-
status: 'updating',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
<Meta of={BorderStories} title="Foundations/System/Props/Border" />
|
|
15
|
-
|
|
16
|
-
<AboutHeader {...parameters} />
|
|
17
|
-
|
|
18
|
-
Border props enable you to add and style borders on any side of an element. These properties support directional borders (top, right, bottom, left) as well as convenient shorthands for horizontal and vertical borders. Border radius values connect to the theme's `borderRadii` scale for consistent corner rounding.
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import styled from '@emotion/styled';
|
|
22
|
-
import { system } from '@codecademy/gamut-styles';
|
|
23
|
-
|
|
24
|
-
const BorderExample = styled.div(system.border);
|
|
25
|
-
|
|
26
|
-
<BorderExample
|
|
27
|
-
border={1}
|
|
28
|
-
borderLeft="none"
|
|
29
|
-
borderRightStyle="dotted"
|
|
30
|
-
borderRadius="md"
|
|
31
|
-
/>;
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
These border props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
|
|
35
|
-
|
|
36
|
-
<Callout
|
|
37
|
-
text={
|
|
38
|
-
<>
|
|
39
|
-
You can use the <strong>LogicalProps</strong> button in the toolbar to
|
|
40
|
-
switch between modes.
|
|
41
|
-
</>
|
|
42
|
-
}
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
<Canvas of={BorderStories.DirectionalBorderExample} />
|
|
46
|
-
|
|
47
|
-
<Canvas of={BorderStories.BorderWidthExample} />
|
|
48
|
-
|
|
49
|
-
<Canvas of={BorderStories.BorderRadiusExample} />
|
|
50
|
-
|
|
51
|
-
<Canvas of={BorderStories.BorderStyleExample} />
|
|
52
|
-
|
|
53
|
-
<TokenTable rows={getPropRows('border')} columns={defaultColumns} />
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Box, FlexBox, Markdown } from '@codecademy/gamut';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Box> = {
|
|
5
|
-
title: 'Foundations/System/Props/Border',
|
|
6
|
-
component: Box,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof Box>;
|
|
11
|
-
|
|
12
|
-
export const DirectionalBorderExample: Story = {
|
|
13
|
-
render: () => (
|
|
14
|
-
<FlexBox gap={16} row>
|
|
15
|
-
<Box
|
|
16
|
-
bg="background-selected"
|
|
17
|
-
borderX={2}
|
|
18
|
-
borderY={1}
|
|
19
|
-
p={16}
|
|
20
|
-
textAlign="center"
|
|
21
|
-
>
|
|
22
|
-
This box has <Markdown text="`borderX={2}`, `borderY={1}`." /> Inspect
|
|
23
|
-
the example to see what CSS properties are rendered based on the logical
|
|
24
|
-
properties mode.
|
|
25
|
-
</Box>
|
|
26
|
-
<Box
|
|
27
|
-
bg="background-selected"
|
|
28
|
-
borderLeft={2}
|
|
29
|
-
borderRight={1}
|
|
30
|
-
p={16}
|
|
31
|
-
textAlign="center"
|
|
32
|
-
>
|
|
33
|
-
This box has <Markdown text="`borderLeft={2}`, `borderRight={1}`." />{' '}
|
|
34
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
35
|
-
logical properties mode.
|
|
36
|
-
</Box>
|
|
37
|
-
</FlexBox>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const BorderWidthExample: Story = {
|
|
42
|
-
render: () => (
|
|
43
|
-
<FlexBox gap={16} row>
|
|
44
|
-
<Box
|
|
45
|
-
bg="background-selected"
|
|
46
|
-
border={1}
|
|
47
|
-
borderWidthX="4px"
|
|
48
|
-
borderWidthY="10px"
|
|
49
|
-
p={16}
|
|
50
|
-
textAlign="center"
|
|
51
|
-
>
|
|
52
|
-
This box has{' '}
|
|
53
|
-
<Markdown text="`borderWidthX='4px'` and `borderWidthY='10px'`." />{' '}
|
|
54
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
55
|
-
logical properties mode.
|
|
56
|
-
</Box>
|
|
57
|
-
<Box
|
|
58
|
-
bg="background-selected"
|
|
59
|
-
border={1}
|
|
60
|
-
borderWidthRight="10px"
|
|
61
|
-
borderWidthTop="4px"
|
|
62
|
-
p={16}
|
|
63
|
-
textAlign="center"
|
|
64
|
-
>
|
|
65
|
-
This box has{' '}
|
|
66
|
-
<Markdown text="`borderWidthTop='4px'` and `borderWidthRight='10px'`." />{' '}
|
|
67
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
68
|
-
logical properties mode.
|
|
69
|
-
</Box>
|
|
70
|
-
</FlexBox>
|
|
71
|
-
),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const BorderRadiusExample: Story = {
|
|
75
|
-
render: () => (
|
|
76
|
-
<FlexBox gap={16} row>
|
|
77
|
-
<Box
|
|
78
|
-
bg="background-selected"
|
|
79
|
-
border={1}
|
|
80
|
-
borderRadiusLeft="lg"
|
|
81
|
-
borderRadiusRight="none"
|
|
82
|
-
p={16}
|
|
83
|
-
textAlign="center"
|
|
84
|
-
>
|
|
85
|
-
This box has{' '}
|
|
86
|
-
<Markdown text="`borderRadiusLeft='lg'` and `borderRadiusRight='none'`." />{' '}
|
|
87
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
88
|
-
logical properties mode.
|
|
89
|
-
</Box>
|
|
90
|
-
<Box
|
|
91
|
-
bg="background-selected"
|
|
92
|
-
border={1}
|
|
93
|
-
borderRadiusBottomLeft="xl"
|
|
94
|
-
borderRadiusTopRight="xl"
|
|
95
|
-
p={16}
|
|
96
|
-
textAlign="center"
|
|
97
|
-
>
|
|
98
|
-
This box has{' '}
|
|
99
|
-
<Markdown text="`borderRadiusTopRight='xl'` and `borderRadiusBottomLeft='xl'`." />{' '}
|
|
100
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
101
|
-
logical properties mode.
|
|
102
|
-
</Box>
|
|
103
|
-
</FlexBox>
|
|
104
|
-
),
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export const BorderStyleExample: Story = {
|
|
108
|
-
render: () => (
|
|
109
|
-
<FlexBox gap={16} row>
|
|
110
|
-
<Box
|
|
111
|
-
bg="background-selected"
|
|
112
|
-
border={1}
|
|
113
|
-
borderStyleX="dashed"
|
|
114
|
-
borderStyleY="dotted"
|
|
115
|
-
p={16}
|
|
116
|
-
textAlign="center"
|
|
117
|
-
>
|
|
118
|
-
This box has{' '}
|
|
119
|
-
<Markdown text="`borderStyleX='dashed'` and `borderStyleY='dotted'`." />{' '}
|
|
120
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
121
|
-
logical properties mode.
|
|
122
|
-
</Box>
|
|
123
|
-
<Box
|
|
124
|
-
bg="background-selected"
|
|
125
|
-
border={1}
|
|
126
|
-
borderStyleBottom="dotted"
|
|
127
|
-
borderStyleLeft="dashed"
|
|
128
|
-
p={16}
|
|
129
|
-
textAlign="center"
|
|
130
|
-
>
|
|
131
|
-
This box has{' '}
|
|
132
|
-
<Markdown text="`borderStyleBottom='dotted'` and `borderStyleLeft='dashed'`." />{' '}
|
|
133
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
134
|
-
logical properties mode.
|
|
135
|
-
</Box>
|
|
136
|
-
</FlexBox>
|
|
137
|
-
),
|
|
138
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
|
|
4
|
-
|
|
5
|
-
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
-
import * as ColorStories from './Color.stories';
|
|
7
|
-
|
|
8
|
-
export const parameters = {
|
|
9
|
-
title: 'Color',
|
|
10
|
-
subtitle: 'Specific color properties',
|
|
11
|
-
status: 'current',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
<Meta of={ColorStories} title="Foundations/System/Props/Color" />
|
|
15
|
-
|
|
16
|
-
<AboutHeader {...parameters} />
|
|
17
|
-
|
|
18
|
-
Color props control the foreground, background, and border colors of elements. All color values are restricted to your theme's color palette, ensuring consistent color usage throughout your application. The `bg` shorthand provides a convenient way to set background colors quickly.
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import styled from '@emotion/styled';
|
|
22
|
-
import { system } from '@codecademy/gamut-styles';
|
|
23
|
-
|
|
24
|
-
const ColorExample = styled.div(system.color);
|
|
25
|
-
|
|
26
|
-
<ColorExample bg="navy" textColor="gray-100" borderColor="blue" />;
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
These color props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
|
|
30
|
-
|
|
31
|
-
<Callout
|
|
32
|
-
text={
|
|
33
|
-
<>
|
|
34
|
-
You can use the <strong>LogicalProps</strong> button in the toolbar to
|
|
35
|
-
switch between modes.
|
|
36
|
-
</>
|
|
37
|
-
}
|
|
38
|
-
/>
|
|
39
|
-
|
|
40
|
-
<Canvas of={ColorStories.BorderColorExample} />
|
|
41
|
-
|
|
42
|
-
<TokenTable rows={getPropRows('color')} columns={defaultColumns} />
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Box, FlexBox, Markdown } from '@codecademy/gamut';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Box> = {
|
|
5
|
-
title: 'Foundations/System/Props/Color',
|
|
6
|
-
component: Box,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof Box>;
|
|
11
|
-
|
|
12
|
-
export const BorderColorExample: Story = {
|
|
13
|
-
render: () => (
|
|
14
|
-
<FlexBox gap={16} row>
|
|
15
|
-
<Box
|
|
16
|
-
bg="background-selected"
|
|
17
|
-
border={1}
|
|
18
|
-
borderColorX="feedback-success"
|
|
19
|
-
borderColorY="feedback-error"
|
|
20
|
-
borderWidth="4px"
|
|
21
|
-
p={16}
|
|
22
|
-
textAlign="center"
|
|
23
|
-
>
|
|
24
|
-
This box has{' '}
|
|
25
|
-
<Markdown text="`borderColorX='feedback-success'` and `borderColorY='feedback-error'`." />{' '}
|
|
26
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
27
|
-
logical properties mode.
|
|
28
|
-
</Box>
|
|
29
|
-
<Box
|
|
30
|
-
bg="background-selected"
|
|
31
|
-
border={1}
|
|
32
|
-
borderColorBottom="feedback-warning"
|
|
33
|
-
borderColorLeft="feedback-success"
|
|
34
|
-
borderColorRight="feedback-error"
|
|
35
|
-
borderColorTop="interface"
|
|
36
|
-
borderWidth="4px"
|
|
37
|
-
p={16}
|
|
38
|
-
textAlign="center"
|
|
39
|
-
>
|
|
40
|
-
This box has{' '}
|
|
41
|
-
<Markdown text="`borderColorBottom='feedback-warning'`, `borderColorLeft='feedback-success'`, `borderColorRight='feedback-error'`, and `borderColorTop='interface'`." />{' '}
|
|
42
|
-
Inspect the example to see what CSS properties are rendered based on the
|
|
43
|
-
logical properties mode.
|
|
44
|
-
</Box>
|
|
45
|
-
</FlexBox>
|
|
46
|
-
),
|
|
47
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
4
|
-
|
|
5
|
-
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
-
|
|
7
|
-
export const parameters = {
|
|
8
|
-
title: 'Flex',
|
|
9
|
-
subtitle: 'Flex specific properties',
|
|
10
|
-
status: 'current',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
<Meta title="Foundations/System/Props/Flex" />
|
|
14
|
-
|
|
15
|
-
<AboutHeader {...parameters} />
|
|
16
|
-
|
|
17
|
-
Flex props provide complete control over flexbox layouts, from container behavior to individual flex item properties. These properties make it easy to create flexible, responsive layouts with proper alignment and distribution of child elements. Use these on flex containers to control their children or on flex items to control their own behavior.
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import styled from '@emotion/styled';
|
|
21
|
-
import { system } from '@codecademy/gamut-styles';
|
|
22
|
-
|
|
23
|
-
const FlexExample = styled.div(system.flex);
|
|
24
|
-
|
|
25
|
-
<FlexExample flex={1} justifyContent="center" alignItems="flex-start" />;
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
<TokenTable rows={getPropRows('flex')} columns={defaultColumns} />
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
4
|
-
|
|
5
|
-
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
-
|
|
7
|
-
export const parameters = {
|
|
8
|
-
title: 'Grid',
|
|
9
|
-
subtitle: 'Grid specific properties',
|
|
10
|
-
status: 'current',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
<Meta title="Foundations/System/Props/Grid" />
|
|
14
|
-
|
|
15
|
-
<AboutHeader {...parameters} />
|
|
16
|
-
|
|
17
|
-
Grid props give you powerful control over CSS Grid layouts. Define grid templates, control auto-placement behavior, and set gaps between grid items. These properties make it straightforward to create complex, responsive grid layouts with precise control over both container and item positioning.
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import styled from '@emotion/styled';
|
|
21
|
-
import { system } from '@codecademy/gamut-styles';
|
|
22
|
-
|
|
23
|
-
const GridExample = styled.div(system.grid);
|
|
24
|
-
|
|
25
|
-
<GridExample
|
|
26
|
-
gridTemplateColumns="max-content 1fr max-content"
|
|
27
|
-
columnGap={32}
|
|
28
|
-
/>;
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
<TokenTable rows={getPropRows('grid')} columns={defaultColumns} />
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
4
|
-
|
|
5
|
-
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
-
|
|
7
|
-
export const parameters = {
|
|
8
|
-
title: 'Layout',
|
|
9
|
-
subtitle:
|
|
10
|
-
'Props for handling dimensions and other layout specific properties.',
|
|
11
|
-
status: 'updating',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
<Meta title="Foundations/System/Props/Layout" />
|
|
15
|
-
|
|
16
|
-
<AboutHeader {...parameters} />
|
|
17
|
-
|
|
18
|
-
Layout props control the visual structure and dimensions of elements. These properties determine how components take up space, their display behavior, and how they align within their containers. Use these props to set widths, heights, overflow behavior, and container types for responsive layouts.
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import styled from '@emotion/styled';
|
|
22
|
-
import { system } from '@codecademy/gamut-styles';
|
|
23
|
-
|
|
24
|
-
const LayoutExample = styled.div(system.layout);
|
|
25
|
-
|
|
26
|
-
<LayoutExample
|
|
27
|
-
display="flex"
|
|
28
|
-
width="50%"
|
|
29
|
-
height="300px"
|
|
30
|
-
verticalAlign="middle"
|
|
31
|
-
/>;
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
<TokenTable rows={getPropRows('layout')} columns={defaultColumns} />
|