@codecademy/styleguide 79.0.1-alpha.bd18ee.0 → 79.0.1-alpha.c4250e.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.
Files changed (37) hide show
  1. package/.storybook/components/Elements/DocsContainer.tsx +0 -4
  2. package/.storybook/components/Elements/Markdown.tsx +1 -0
  3. package/.storybook/preview.ts +5 -15
  4. package/.storybook/theming/GamutThemeProvider.tsx +1 -7
  5. package/CHANGELOG.md +1 -1
  6. package/package.json +2 -2
  7. package/src/lib/Atoms/Badge/Badge.mdx +1 -1
  8. package/src/lib/Foundations/System/About.mdx +1 -1
  9. package/src/lib/Foundations/System/Compose.mdx +1 -1
  10. package/src/lib/Foundations/System/Props.mdx +230 -0
  11. package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.mdx +3 -3
  12. package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.stories.tsx +0 -1
  13. package/src/lib/Foundations/shared/elements.tsx +19 -69
  14. package/src/lib/Meta/About.mdx +3 -3
  15. package/src/lib/Meta/MCP/About.mdx +28 -0
  16. package/src/lib/Meta/MCP/Code Connect.mdx +38 -0
  17. package/src/lib/Meta/MCP/Figma MCP.mdx +89 -0
  18. package/src/lib/Meta/Usage Guide.mdx +1 -6
  19. package/src/lib/Molecules/Alert/Alert.mdx +1 -1
  20. package/src/static/mcp/component_playground.png +0 -0
  21. package/src/static/mcp/component_with_code_connect.png +0 -0
  22. package/src/static/meta/toolbar.png +0 -0
  23. package/src/lib/Foundations/System/Props/About.mdx +0 -81
  24. package/src/lib/Foundations/System/Props/Background.mdx +0 -30
  25. package/src/lib/Foundations/System/Props/Border.mdx +0 -33
  26. package/src/lib/Foundations/System/Props/Color.mdx +0 -28
  27. package/src/lib/Foundations/System/Props/Flex.mdx +0 -28
  28. package/src/lib/Foundations/System/Props/Grid.mdx +0 -31
  29. package/src/lib/Foundations/System/Props/Layout.mdx +0 -45
  30. package/src/lib/Foundations/System/Props/Layout.stories.tsx +0 -47
  31. package/src/lib/Foundations/System/Props/List.mdx +0 -38
  32. package/src/lib/Foundations/System/Props/Positioning.mdx +0 -29
  33. package/src/lib/Foundations/System/Props/Shadow.mdx +0 -31
  34. package/src/lib/Foundations/System/Props/Space.mdx +0 -44
  35. package/src/lib/Foundations/System/Props/Space.stories.tsx +0 -48
  36. package/src/lib/Foundations/System/Props/Typography.mdx +0 -28
  37. package/src/lib/Meta/Logical and physical CSS properties.mdx +0 -123
@@ -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. LogicalProps (the two arrows icon) - toggles between physical and logical CSS properties
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 dont miss critical information
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
@@ -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,33 +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: 'Border',
9
- subtitle: 'Border styles',
10
- status: 'updating',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Border" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- 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.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const BorderExample = styled.div(system.border);
24
-
25
- <BorderExample
26
- border={1}
27
- borderLeft="none"
28
- borderRightStyle="dotted"
29
- borderRadius="md"
30
- />;
31
- ```
32
-
33
- <TokenTable rows={getPropRows('border')} columns={defaultColumns} />
@@ -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: 'Color',
9
- subtitle: 'Specific color properties',
10
- status: 'current',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Color" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- 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.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const ColorExample = styled.div(system.color);
24
-
25
- <ColorExample bg="navy" textColor="gray-100" borderColor="blue" />;
26
- ```
27
-
28
- <TokenTable rows={getPropRows('color')} columns={defaultColumns} />
@@ -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,45 +0,0 @@
1
- import { Canvas, Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
- import * as LayoutStories from './Layout.stories';
7
-
8
- export const parameters = {
9
- title: 'Layout',
10
- subtitle:
11
- 'Props for handling dimensions and other layout specific properties.',
12
- status: 'updating',
13
- };
14
-
15
- <Meta title="Foundations/System/Props/Layout" of={LayoutStories} />
16
-
17
- <AboutHeader {...parameters} />
18
-
19
- 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.
20
-
21
- ```tsx
22
- import styled from '@emotion/styled';
23
- import { system } from '@codecademy/gamut-styles';
24
-
25
- const LayoutExample = styled.div(system.layout);
26
-
27
- <LayoutExample
28
- display="flex"
29
- width="50%"
30
- height="300px"
31
- verticalAlign="middle"
32
- />;
33
- ```
34
-
35
- ## Examples
36
-
37
- ### Width
38
-
39
- <Canvas of={LayoutStories.WidthExample} />
40
-
41
- ### Direction
42
-
43
- <Canvas of={LayoutStories.DirectionExample} />
44
-
45
- <TokenTable rows={getPropRows('layout')} columns={defaultColumns} />
@@ -1,47 +0,0 @@
1
- import { Box, Markdown } from '@codecademy/gamut';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- const meta: Meta<typeof Box> = {
5
- title: 'Foundations/System/Props/Layout',
6
- component: Box,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof Box>;
11
-
12
- export const WidthExample: Story = {
13
- render: () => (
14
- <Box bg="background-selected" p={16}>
15
- <Box
16
- bg="primary"
17
- color="background-contrast"
18
- height="300px"
19
- p={16}
20
- width="50%"
21
- >
22
- This box has <Markdown text="`width='50%' and height='300px'`." /> It
23
- takes up half the width of its container. Inspect the box to see the
24
- rendered CSS property.
25
- </Box>
26
- </Box>
27
- ),
28
- };
29
-
30
- export const DirectionExample: Story = {
31
- render: () => (
32
- <Box display="flex" flexDirection="row" gap={16}>
33
- <Box bg="background-selected" p={16} width="50%">
34
- <Box bg="primary" color="background-contrast" direction="ltr" p={16}>
35
- <Markdown text="`direction='ltr'`." /> Left-to-right text direction
36
- (default for English).
37
- </Box>
38
- </Box>
39
- <Box bg="background-selected" p={16} width="50%">
40
- <Box bg="primary" color="background-contrast" direction="rtl" p={16}>
41
- <Markdown text="`direction='rtl'`." /> Right-to-left text direction
42
- (used for Arabic, Hebrew, etc.).
43
- </Box>
44
- </Box>
45
- </Box>
46
- ),
47
- };
@@ -1,38 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, LinkTo, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'List',
9
- subtitle:
10
- 'Props for adjusting list styles when rendering a component as a `ul` or `ol`',
11
- status: 'current',
12
- };
13
-
14
- <Meta title="Foundations/System/Props/List" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- List props control the appearance of ordered and unordered lists when components are rendered as `ul` or `ol` elements. These properties let you customize bullet styles, list positioning, and even use custom images as list markers, giving you full control over list presentation.
19
-
20
- For more advanced list features, refer to the <LinkTo id="Organisms/Lists & Tables/List">List component</LinkTo>.
21
-
22
- ```tsx
23
- import styled from '@emotion/styled';
24
- import { system } from '@codecademy/gamut-styles';
25
-
26
- const ListExample = styled.div(system.list);
27
-
28
- <ListExample
29
- as="ul"
30
- listStyleType="square"
31
- listStylePosition="inside"
32
- listStyleImage="none"
33
- >
34
- <ListExample as="li">a list item</ListExample>
35
- </ListExample>;
36
- ```
37
-
38
- <TokenTable rows={getPropRows('list')} columns={defaultColumns} />
@@ -1,29 +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: 'Positioning',
9
- subtitle:
10
- 'Props that affect stacking and position contexts. Like `top`, `position` and `opacity`.',
11
- status: 'updating',
12
- };
13
-
14
- <Meta title="Foundations/System/Props/Positioning" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- Positioning props control how elements are positioned within their parent containers and manage their stacking order. Use these properties to create fixed headers, absolute overlays, sticky navigation, and control layering with z-index. The `inset` shorthand provides a convenient way to set all four position values at once.
19
-
20
- ```tsx
21
- import styled from '@emotion/styled';
22
- import { system } from '@codecademy/gamut-styles';
23
-
24
- const PositioningExample = styled.div(system.positioning);
25
-
26
- <PositioningExample position="absolute" zIndex={2} top="0" left="0" />;
27
- ```
28
-
29
- <TokenTable rows={getPropRows('positioning')} 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: 'Shadow',
9
- subtitle: 'Props for box and text shadows.',
10
- status: 'current',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Shadow" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- Shadow props add depth and visual interest to your components through box and text shadows. These properties accept standard CSS shadow syntax, allowing you to create subtle elevation effects or dramatic visual depth. Use shadows consistently to establish visual hierarchy in your interface.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const ShadowExample = styled.div(system.shadow);
24
-
25
- <ShadowExample
26
- boxShadow="0 0 4px rgba(0, 0, 0, .15)"
27
- textShadow="0 0 4px rgba(0, 0, 0, .15)"
28
- />;
29
- ```
30
-
31
- <TokenTable rows={getPropRows('shadows')} columns={defaultColumns} />
@@ -1,44 +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 SpaceStories from './Space.stories';
7
-
8
- export const parameters = {
9
- title: 'Space',
10
- subtitle: 'Props for maintaining specific vertical and horizontal rhythms',
11
- status: 'updating',
12
- };
13
-
14
- <Meta of={SpaceStories} title="Foundations/System/Props/Space" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- Space props provide a consistent way to apply margin and padding throughout your application. All spacing values reference the theme's spacing scale, ensuring visual consistency and making it easy to create responsive spacing patterns using array syntax.
19
-
20
- ```tsx
21
- import styled from '@emotion/styled';
22
- import { system } from '@codecademy/gamut-styles';
23
-
24
- const SpaceExample = styled.div(system.space);
25
-
26
- <SpaceExample p={8} my={[16, 24, 32]} />;
27
- ```
28
-
29
- These space 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={SpaceStories.MarginExample} />
41
-
42
- <Canvas of={SpaceStories.PaddingExample} />
43
-
44
- <TokenTable rows={getPropRows('space')} columns={defaultColumns} />
@@ -1,48 +0,0 @@
1
- import { Box, Markdown } from '@codecademy/gamut';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- const meta: Meta<typeof Box> = {
5
- title: 'Foundations/System/Props/Space',
6
- component: Box,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof Box>;
11
-
12
- export const MarginExample: Story = {
13
- render: () => (
14
- <Box
15
- bg="primary"
16
- color="background-contrast"
17
- mb={64}
18
- ml={16}
19
- mr={32}
20
- mt={4}
21
- textAlign="center"
22
- >
23
- This box has{' '}
24
- <Markdown text="`mt={4}`, `mr={32}`, `mb={64}`, and `ml={16}`." /> Inspect
25
- the example to see what CSS properties are rendered.
26
- </Box>
27
- ),
28
- };
29
-
30
- export const PaddingExample: Story = {
31
- render: () => (
32
- <Box bg="background-selected">
33
- <Box
34
- bg="primary"
35
- color="background-contrast"
36
- pb={64}
37
- pl={16}
38
- pr={32}
39
- pt={4}
40
- textAlign="center"
41
- >
42
- This box has{' '}
43
- <Markdown text="`pt={4}`, `pr={32}`, `pb={64}`, and `pl={16}`." />{' '}
44
- Inspect the example to see what CSS properties are rendered.
45
- </Box>
46
- </Box>
47
- ),
48
- };