@codecademy/styleguide 79.1.0-alpha.e84769.0 → 79.1.1-alpha.0165b9.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/Markdown.tsx +1 -0
- package/.storybook/preview.ts +24 -16
- package/.storybook/theming/GamutThemeProvider.tsx +1 -7
- package/CHANGELOG.md +6 -3
- package/package.json +2 -2
- 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 +8 -8
- package/src/lib/Meta/{Best Practices.mdx → Best practices.mdx } +3 -3
- package/src/lib/Meta/Gamut writing guide/About.mdx +43 -0
- package/src/lib/Meta/Gamut writing guide/Documentation in code.mdx +134 -0
- package/src/lib/Meta/Gamut writing guide/Formatting.mdx +69 -0
- package/src/lib/Meta/Gamut writing guide/General principles.mdx +46 -0
- package/src/lib/Meta/Gamut writing guide/Language and grammar.mdx +54 -0
- package/src/lib/Meta/Gamut writing guide/Linking.mdx +60 -0
- package/src/lib/Meta/Gamut writing guide/Referencing code.mdx +86 -0
- package/src/lib/Meta/Gamut writing guide/Stories/About pages.mdx +49 -0
- package/src/lib/Meta/Gamut writing guide/Stories/About.mdx +57 -0
- package/src/lib/Meta/Gamut writing guide/Stories/Component code examples.mdx +79 -0
- package/src/lib/Meta/{Stories.mdx → Gamut writing guide/Stories/Component story documentation.mdx } +19 -85
- 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 → Usage guide.mdx } +4 -9
- 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
- /package/src/lib/Meta/{Deep Controls Add-On.mdx → Deep Controls add-on.mdx} +0 -0
|
@@ -52,9 +52,6 @@ export const DocsContainer: React.FC<{
|
|
|
52
52
|
|
|
53
53
|
const globalTheme =
|
|
54
54
|
(context as any).store.userGlobals?.globals?.theme || 'core';
|
|
55
|
-
const globalLogicalProps = (context as any).store.userGlobals?.globals
|
|
56
|
-
?.logicalProps;
|
|
57
|
-
const useLogicalProperties = globalLogicalProps !== 'false';
|
|
58
55
|
|
|
59
56
|
const { currentTheme } = useMemo(() => {
|
|
60
57
|
const findThemeStory: keyof typeof themeSpecificStories | undefined =
|
|
@@ -80,7 +77,6 @@ export const DocsContainer: React.FC<{
|
|
|
80
77
|
cache={createEmotionCache({ speedy: false })}
|
|
81
78
|
// This is typed to the CoreTheme in theme.d.ts
|
|
82
79
|
theme={currentTheme as unknown as CoreTheme}
|
|
83
|
-
useLogicalProperties={useLogicalProperties}
|
|
84
80
|
>
|
|
85
81
|
<ColorMode mode="light">
|
|
86
82
|
<HelmetProvider>
|
package/.storybook/preview.ts
CHANGED
|
@@ -45,12 +45,33 @@ const preview: Preview = {
|
|
|
45
45
|
'Meta',
|
|
46
46
|
[
|
|
47
47
|
'About',
|
|
48
|
-
'
|
|
49
|
-
'
|
|
48
|
+
'Brand',
|
|
49
|
+
'Best practices',
|
|
50
50
|
'Contributing',
|
|
51
|
+
'Deep Controls add-on',
|
|
52
|
+
'ESLint rules',
|
|
51
53
|
'FAQs',
|
|
52
|
-
'
|
|
54
|
+
'Installation',
|
|
53
55
|
'Stories',
|
|
56
|
+
'Usage guide',
|
|
57
|
+
'MCP',
|
|
58
|
+
'Gamut writing guide',
|
|
59
|
+
[
|
|
60
|
+
'About',
|
|
61
|
+
'General principles',
|
|
62
|
+
'Documentation in code',
|
|
63
|
+
'Formatting',
|
|
64
|
+
'Language and grammar',
|
|
65
|
+
'Linking',
|
|
66
|
+
'Referencing code',
|
|
67
|
+
'Stories',
|
|
68
|
+
[
|
|
69
|
+
'About',
|
|
70
|
+
'About pages',
|
|
71
|
+
'Component story documentation',
|
|
72
|
+
'Component code examples',
|
|
73
|
+
],
|
|
74
|
+
],
|
|
54
75
|
],
|
|
55
76
|
'Foundations',
|
|
56
77
|
'Layouts',
|
|
@@ -164,19 +185,6 @@ export const globalTypes = {
|
|
|
164
185
|
showName: true,
|
|
165
186
|
},
|
|
166
187
|
},
|
|
167
|
-
logicalProps: {
|
|
168
|
-
name: 'LogicalProps',
|
|
169
|
-
description: 'Toggle between logical and physical CSS properties',
|
|
170
|
-
defaultValue: 'true',
|
|
171
|
-
toolbar: {
|
|
172
|
-
icon: 'transfer',
|
|
173
|
-
items: [
|
|
174
|
-
{ value: 'true', title: 'Logical' },
|
|
175
|
-
{ value: 'false', title: 'Physical' },
|
|
176
|
-
],
|
|
177
|
-
showName: true,
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
188
|
};
|
|
181
189
|
|
|
182
190
|
export const decorators = [withEmotion];
|
|
@@ -34,14 +34,12 @@ type GlobalsContext = {
|
|
|
34
34
|
globals: {
|
|
35
35
|
colorMode: 'light' | 'dark';
|
|
36
36
|
theme: keyof typeof themeMap;
|
|
37
|
-
logicalProps: 'true' | 'false';
|
|
38
37
|
};
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
42
41
|
const colorMode = context.globals.colorMode ?? 'light';
|
|
43
42
|
const selectedTheme = context.globals.theme;
|
|
44
|
-
const useLogicalProperties = context.globals.logicalProps !== 'false';
|
|
45
43
|
const background = corePalette[themeBackground[colorMode]];
|
|
46
44
|
const storyRef = useRef<HTMLDivElement>(null);
|
|
47
45
|
const currentTheme = themeMap[selectedTheme];
|
|
@@ -59,7 +57,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
59
57
|
<GamutProvider
|
|
60
58
|
useCache={false}
|
|
61
59
|
useGlobals={false}
|
|
62
|
-
useLogicalProperties={useLogicalProperties}
|
|
63
60
|
theme={currentTheme as unknown as Theme}
|
|
64
61
|
>
|
|
65
62
|
<Background
|
|
@@ -75,10 +72,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
75
72
|
|
|
76
73
|
// Wrap all stories in minimal provider
|
|
77
74
|
return (
|
|
78
|
-
<GamutProvider
|
|
79
|
-
useLogicalProperties={useLogicalProperties}
|
|
80
|
-
theme={currentTheme as unknown as Theme}
|
|
81
|
-
>
|
|
75
|
+
<GamutProvider theme={currentTheme as unknown as Theme}>
|
|
82
76
|
<Background
|
|
83
77
|
alwaysSetVariables
|
|
84
78
|
bg={themeBackground[colorMode]}
|
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,15 @@
|
|
|
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
|
-
|
|
6
|
+
### [79.1.1-alpha.0165b9.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.0...@codecademy/styleguide@79.1.1-alpha.0165b9.0) (2026-02-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @codecademy/styleguide
|
|
9
|
+
|
|
10
|
+
## [79.1.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.1.0) (2026-02-09)
|
|
7
11
|
|
|
8
12
|
### Features
|
|
9
13
|
|
|
10
|
-
-
|
|
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))
|
|
14
|
+
- Figma CodeConnect and MCP documentation and enablement ([7236a27](https://github.com/Codecademy/gamut/commit/7236a27ecc88eb6794049f06928e6c573213ae60))
|
|
12
15
|
|
|
13
16
|
## [79.0.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@78.5.5...@codecademy/styleguide@79.0.0) (2026-01-29)
|
|
14
17
|
|
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.1.
|
|
4
|
+
"version": "79.1.1-alpha.0165b9.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": "36a5b43d98d0c4bc396b0abaa56bcfb52b757904"
|
|
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
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '~styleguide/blocks';
|
|
8
8
|
|
|
9
9
|
import { parameters as composeParameters } from './Compose.mdx';
|
|
10
|
-
import { parameters as propsParameters } from './Props
|
|
10
|
+
import { parameters as propsParameters } from './Props.mdx';
|
|
11
11
|
import { parameters as responsivePropertiesParameters } from './ResponsiveProperties/ResponsiveProperties.mdx';
|
|
12
12
|
import { parameters as variantsParameters } from './Variants.mdx';
|
|
13
13
|
|
|
@@ -0,0 +1,230 @@
|
|
|
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: 'Props',
|
|
9
|
+
subtitle:
|
|
10
|
+
'Reusable CSS-in-JS props with predictable behaviors and a consistent API for responsive CSS.',
|
|
11
|
+
source: {
|
|
12
|
+
repo: 'gamut-styles',
|
|
13
|
+
githubLink:
|
|
14
|
+
'https://github.com/Codecademy/gamut/blob/af5be6e39cccca5d5d8a1f811c77a7a0b618c914/packages/gamut-styles/src/variance/config.ts#L11',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
<Meta title="Foundations/System/Props" />
|
|
19
|
+
|
|
20
|
+
<AboutHeader {...parameters} />
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
System props have a few facets that are important to note:
|
|
25
|
+
|
|
26
|
+
- They can some times represent multiple properties.
|
|
27
|
+
- They may be restricted to specific token scales but will always have access to global css values like `initial` and `none`.
|
|
28
|
+
- They may have a function that transforms the given value into a standardized value (e.g. `width={.5}` => `width: 50%`)
|
|
29
|
+
|
|
30
|
+
We've grouped these into a few main groups that affect simliar behaviors: `layout`, `space`, `color`, `border`, `background`, `typography`, `positioning`, `grid`, `flex`, `shadow`.
|
|
31
|
+
|
|
32
|
+
You may import these groups directly from `gamut-styles`.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { variance } from '@codecademy/variance';
|
|
36
|
+
import { system } from '@codecademy/gamut-styles';
|
|
37
|
+
|
|
38
|
+
const Box = styled.div(variance.compose(system.layout, system.positioning));
|
|
39
|
+
|
|
40
|
+
<Box position="absolute" width="50px" height="50px" />;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Each system prop has 3 important features:
|
|
44
|
+
|
|
45
|
+
- `properties`: Any number of CSS Properties this prop is responsible for.
|
|
46
|
+
- `scale`: A set of values that determines valid inputs for each prop (e.g. a scale of `colors` will restrict to only theme 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.
|
|
47
|
+
- `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.
|
|
48
|
+
|
|
49
|
+
<br />
|
|
50
|
+
|
|
51
|
+
## Layout
|
|
52
|
+
|
|
53
|
+
Props for handling dimensions and other layout specific properties.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import styled from '@emotion/styled';
|
|
57
|
+
import { system } from '@codecademy/gamut-styles';
|
|
58
|
+
|
|
59
|
+
const Box = styled.div(system.layout);
|
|
60
|
+
|
|
61
|
+
<Box display="flex" width="50%" height="300px" verticalAlign="middle" />;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
<TokenTable rows={getPropRows('layout')} columns={defaultColumns} />
|
|
65
|
+
|
|
66
|
+
## Space
|
|
67
|
+
|
|
68
|
+
Props for maintaining specific vertical and horizontal rhythms
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import styled from '@emotion/styled';
|
|
72
|
+
import { system } from '@codecademy/gamut-styles';
|
|
73
|
+
|
|
74
|
+
const Spacer = styled.div(system.space);
|
|
75
|
+
|
|
76
|
+
<Spacer p={8} my={[16, 24, 32]} />;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
<TokenTable rows={getPropRows('space')} columns={defaultColumns} />
|
|
80
|
+
|
|
81
|
+
## Typography
|
|
82
|
+
|
|
83
|
+
Props for text manipulation
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import styled from '@emotion/styled';
|
|
87
|
+
import { system } from '@codecademy/gamut-styles';
|
|
88
|
+
|
|
89
|
+
const Text = styled.p(system.typography);
|
|
90
|
+
|
|
91
|
+
<Text fontSize={16} fontFamily="accent" textTransform="uppercase" />;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
<TokenTable rows={getPropRows('typography')} columns={defaultColumns} />
|
|
95
|
+
|
|
96
|
+
## Color
|
|
97
|
+
|
|
98
|
+
Specific color properties
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import styled from '@emotion/styled';
|
|
102
|
+
import { system } from '@codecademy/gamut-styles';
|
|
103
|
+
|
|
104
|
+
const Background = styled.div(system.color);
|
|
105
|
+
|
|
106
|
+
<Background bg="navy" textColor="gray-100" borderColor="blue" />;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<TokenTable rows={getPropRows('color')} columns={defaultColumns} />
|
|
110
|
+
|
|
111
|
+
## Border
|
|
112
|
+
|
|
113
|
+
Border styles
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import styled from '@emotion/styled';
|
|
117
|
+
import { system } from '@codecademy/gamut-styles';
|
|
118
|
+
|
|
119
|
+
const Box = styled.div(system.border);
|
|
120
|
+
|
|
121
|
+
<Box
|
|
122
|
+
border={1}
|
|
123
|
+
borderLeft="none"
|
|
124
|
+
borderRightStyle="dotted"
|
|
125
|
+
borderRadius="md"
|
|
126
|
+
/>;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
<TokenTable rows={getPropRows('border')} columns={defaultColumns} />
|
|
130
|
+
|
|
131
|
+
## Flex
|
|
132
|
+
|
|
133
|
+
Flex specific properties
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import styled from '@emotion/styled';
|
|
137
|
+
import { system } from '@codecademy/gamut-styles';
|
|
138
|
+
|
|
139
|
+
const FlexBox = styled.div(system.flex);
|
|
140
|
+
|
|
141
|
+
<FlexBox flex={1} justifyContent="center" alignItems="flex-start" />;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
<TokenTable rows={getPropRows('flex')} columns={defaultColumns} />
|
|
145
|
+
|
|
146
|
+
## Grid
|
|
147
|
+
|
|
148
|
+
Grid specific properties
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import styled from '@emotion/styled';
|
|
152
|
+
import { system } from '@codecademy/gamut-styles';
|
|
153
|
+
|
|
154
|
+
const GridBox = styled.div(system.grid);
|
|
155
|
+
|
|
156
|
+
<GridBox gridTemplateColumns="max-content 1fr max-content" columnGap={32} />;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
<TokenTable rows={getPropRows('grid')} columns={defaultColumns} />
|
|
160
|
+
|
|
161
|
+
## Background
|
|
162
|
+
|
|
163
|
+
Props for background manipulation (sizing / repitition / images), for background color see `colors`.
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import styled from '@emotion/styled';
|
|
167
|
+
import { system } from '@codecademy/gamut-styles';
|
|
168
|
+
import myBg from './myBg.png';
|
|
169
|
+
|
|
170
|
+
const Box = styled.div(system.background);
|
|
171
|
+
|
|
172
|
+
<Box background={`url(${myBg}`} backgroundSize="cover" />;
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
<TokenTable rows={getPropRows('background')} columns={defaultColumns} />
|
|
176
|
+
|
|
177
|
+
## Positioning
|
|
178
|
+
|
|
179
|
+
Props that affect stacking and position contexts. Like `top`, `position` and `opacity`.
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import styled from '@emotion/styled';
|
|
183
|
+
import { system } from '@codecademy/gamut-styles';
|
|
184
|
+
|
|
185
|
+
const Box = styled.div(system.positioning);
|
|
186
|
+
|
|
187
|
+
<Box position="absolute" zIndex={2} top="0" left="0" />;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
<TokenTable rows={getPropRows('positioning')} columns={defaultColumns} />
|
|
191
|
+
|
|
192
|
+
## Shadow
|
|
193
|
+
|
|
194
|
+
Props for box and text shadows.
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
import styled from '@emotion/styled';
|
|
198
|
+
import { system } from '@codecademy/gamut-styles';
|
|
199
|
+
|
|
200
|
+
const Box = styled.div(system.shadow);
|
|
201
|
+
|
|
202
|
+
<Box
|
|
203
|
+
boxShadow="0 0 4px rgba(0, 0, 0, .15)"
|
|
204
|
+
textShadow="0 0 4px rgba(0, 0, 0, .15)"
|
|
205
|
+
/>;
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
<TokenTable rows={getPropRows('shadows')} columns={defaultColumns} />
|
|
209
|
+
|
|
210
|
+
## List
|
|
211
|
+
|
|
212
|
+
Props for adjusting list styles when rendering a component as a `ul` or `ol`
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import styled from '@emotion/styled';
|
|
216
|
+
import { system } from '@codecademy/gamut-styles';
|
|
217
|
+
|
|
218
|
+
const Box = styled.div(system.list);
|
|
219
|
+
|
|
220
|
+
<Box
|
|
221
|
+
as="ul"
|
|
222
|
+
listStyleType="square"
|
|
223
|
+
listStylePosition="inside"
|
|
224
|
+
listStyleImage="none"
|
|
225
|
+
>
|
|
226
|
+
<Box as="li">a list item</Box>
|
|
227
|
+
</Box>;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
<TokenTable rows={getPropRows('list')} columns={defaultColumns} />
|
|
@@ -6,17 +6,17 @@ import { breakpoint } from '../../shared/elements';
|
|
|
6
6
|
import * as ResponsivePropertiesStories from './ResponsiveProperties.stories';
|
|
7
7
|
|
|
8
8
|
export const parameters = {
|
|
9
|
-
title: 'Responsive
|
|
9
|
+
title: 'Responsive Properties',
|
|
10
10
|
subtitle:
|
|
11
11
|
'All system props accept a syntax to generate responsive styles on a per prop basis',
|
|
12
12
|
source: {
|
|
13
13
|
repo: 'variance',
|
|
14
14
|
githubLink:
|
|
15
|
-
'https://github.com/Codecademy/gamut/blob/
|
|
15
|
+
'https://github.com/Codecademy/gamut/blob/cass-gm-842/packages/variance/src/utils/responsive.ts',
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
<Meta
|
|
19
|
+
<Meta title="Foundations/System/Responsive Properties" />
|
|
20
20
|
|
|
21
21
|
<AboutHeader {...parameters} />
|
|
22
22
|
|
|
@@ -2,32 +2,22 @@ import { Anchor, Box } from '@codecademy/gamut';
|
|
|
2
2
|
import {
|
|
3
3
|
Background,
|
|
4
4
|
coreSwatches,
|
|
5
|
-
css,
|
|
6
5
|
lxStudioColors,
|
|
7
6
|
theme,
|
|
8
7
|
trueColors,
|
|
9
8
|
} from '@codecademy/gamut-styles';
|
|
10
9
|
// eslint-disable-next-line gamut/import-paths
|
|
11
10
|
import * as ALL_PROPS from '@codecademy/gamut-styles/src/variance/config';
|
|
12
|
-
import { useTheme } from '@emotion/react';
|
|
13
|
-
import styled from '@emotion/styled';
|
|
14
11
|
import kebabCase from 'lodash/kebabCase';
|
|
15
12
|
|
|
16
13
|
import { Code, ColorScale, LinkTo, TokenTable } from '~styleguide/blocks';
|
|
17
14
|
|
|
18
15
|
import { applyCorrectNotation } from './applyCorrectNotation';
|
|
19
16
|
|
|
20
|
-
const AnchorCode = styled(Code)(
|
|
21
|
-
css({
|
|
22
|
-
textDecoration: 'underline',
|
|
23
|
-
mx: 4,
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
|
|
27
17
|
export const PROP_COLUMN = {
|
|
28
18
|
key: 'key',
|
|
29
19
|
name: 'Prop',
|
|
30
|
-
size: '
|
|
20
|
+
size: 'md',
|
|
31
21
|
render: ({ id }: any) => <Code>{id}</Code>,
|
|
32
22
|
};
|
|
33
23
|
|
|
@@ -413,61 +403,26 @@ export const DarkModeTable = () => (
|
|
|
413
403
|
);
|
|
414
404
|
/* eslint-disable gamut/import-paths */
|
|
415
405
|
|
|
416
|
-
const PropertiesRenderer = ({
|
|
417
|
-
property,
|
|
418
|
-
properties,
|
|
419
|
-
resolveProperty,
|
|
420
|
-
}: {
|
|
421
|
-
property: string | { physical: string; logical: string };
|
|
422
|
-
properties?: string[] | { physical: string[]; logical: string[] };
|
|
423
|
-
resolveProperty?: (useLogicalProperties: boolean) => 'logical' | 'physical';
|
|
424
|
-
}) => {
|
|
425
|
-
const currentTheme = useTheme() as { useLogicalProperties?: boolean };
|
|
426
|
-
const useLogicalProperties = currentTheme?.useLogicalProperties ?? true;
|
|
427
|
-
|
|
428
|
-
const mode = resolveProperty
|
|
429
|
-
? resolveProperty(useLogicalProperties)
|
|
430
|
-
: 'physical';
|
|
431
|
-
|
|
432
|
-
const resolvedProperty =
|
|
433
|
-
typeof property === 'string' ? property : property[mode];
|
|
434
|
-
|
|
435
|
-
let resolvedProperties: string[];
|
|
436
|
-
if (!properties) {
|
|
437
|
-
resolvedProperties = [resolvedProperty];
|
|
438
|
-
} else if (Array.isArray(properties)) {
|
|
439
|
-
resolvedProperties = properties;
|
|
440
|
-
} else {
|
|
441
|
-
resolvedProperties = properties[mode];
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
return (
|
|
445
|
-
<>
|
|
446
|
-
{resolvedProperties.map((prop) => (
|
|
447
|
-
<Anchor
|
|
448
|
-
href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${kebabCase(
|
|
449
|
-
prop
|
|
450
|
-
)}`}
|
|
451
|
-
key={prop}
|
|
452
|
-
rel=""
|
|
453
|
-
target="_blank"
|
|
454
|
-
>
|
|
455
|
-
<AnchorCode>{kebabCase(prop)}</AnchorCode>
|
|
456
|
-
</Anchor>
|
|
457
|
-
))}
|
|
458
|
-
</>
|
|
459
|
-
);
|
|
460
|
-
};
|
|
461
|
-
|
|
462
406
|
const PROPERTIES_COLUMN = {
|
|
463
407
|
key: 'properties',
|
|
464
408
|
name: 'Properties',
|
|
465
409
|
size: 'xl',
|
|
466
|
-
render: (
|
|
467
|
-
property
|
|
468
|
-
properties
|
|
469
|
-
|
|
470
|
-
|
|
410
|
+
render: ({
|
|
411
|
+
property,
|
|
412
|
+
properties = [property],
|
|
413
|
+
}: {
|
|
414
|
+
property: string;
|
|
415
|
+
properties: string[];
|
|
416
|
+
}) =>
|
|
417
|
+
properties.map((property) => (
|
|
418
|
+
<Anchor
|
|
419
|
+
href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${property}`}
|
|
420
|
+
rel=""
|
|
421
|
+
target="_blank"
|
|
422
|
+
>
|
|
423
|
+
<Code key={property}>{kebabCase(property)}</Code>
|
|
424
|
+
</Anchor>
|
|
425
|
+
)),
|
|
471
426
|
};
|
|
472
427
|
|
|
473
428
|
const SCALE_COLUMN = {
|
|
@@ -475,7 +430,7 @@ const SCALE_COLUMN = {
|
|
|
475
430
|
name: 'Scale',
|
|
476
431
|
size: 'lg',
|
|
477
432
|
render: ({ scale }: { scale: string }) => (
|
|
478
|
-
<LinkTo id=
|
|
433
|
+
<LinkTo id={`foundations-theme--${kebabCase(scale)}`}>{scale}</LinkTo>
|
|
479
434
|
),
|
|
480
435
|
};
|
|
481
436
|
|
|
@@ -483,12 +438,7 @@ const TRANSFORM_COLUMN = {
|
|
|
483
438
|
key: 'transform',
|
|
484
439
|
name: 'Transform',
|
|
485
440
|
size: 'fill',
|
|
486
|
-
render: ({ transform
|
|
487
|
-
<>
|
|
488
|
-
{transform && <Code>{transform?.name}</Code>}
|
|
489
|
-
{resolveProperty && <Code>{resolveProperty?.name}</Code>}
|
|
490
|
-
</>
|
|
491
|
-
),
|
|
441
|
+
render: ({ transform }: any) => transform && <Code>{transform?.name}</Code>,
|
|
492
442
|
};
|
|
493
443
|
|
|
494
444
|
export const defaultColumns = [
|
package/src/lib/Meta/About.mdx
CHANGED
|
@@ -6,16 +6,16 @@ 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';
|
|
15
16
|
import { parameters as installationParameters } from './Installation.mdx';
|
|
16
|
-
import { parameters as
|
|
17
|
-
import { parameters as
|
|
18
|
-
import { parameters as usageGuideParameters } from './Usage Guide.mdx';
|
|
17
|
+
import { parameters as mcpAboutParameters } from './MCP/About.mdx';
|
|
18
|
+
import { parameters as usageGuideParameters } from './Usage guide.mdx';
|
|
19
19
|
|
|
20
20
|
export const parameters = {
|
|
21
21
|
id: 'Meta',
|
|
@@ -35,10 +35,10 @@ export const parameters = {
|
|
|
35
35
|
deepControlsParameters,
|
|
36
36
|
eslintRulesParameters,
|
|
37
37
|
faqsParameters,
|
|
38
|
-
|
|
39
|
-
logicalPhysicalParameters,
|
|
40
|
-
storiesParameters,
|
|
38
|
+
gamutWritingGuideParameters,
|
|
41
39
|
brandParameters,
|
|
40
|
+
installationParameters,
|
|
42
41
|
usageGuideParameters,
|
|
42
|
+
mcpAboutParameters,
|
|
43
43
|
])}
|
|
44
44
|
/>
|
|
@@ -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
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AboutHeader,
|
|
5
|
+
addParentPath,
|
|
6
|
+
LinkTo,
|
|
7
|
+
TableOfContents,
|
|
8
|
+
} from '~styleguide/blocks';
|
|
9
|
+
|
|
10
|
+
import { parameters as documentationInCodeParameters } from './Documentation in code.mdx';
|
|
11
|
+
import { parameters as formattingParameters } from './Formatting.mdx';
|
|
12
|
+
import { parameters as generalPrinciplesParameters } from './General principles.mdx';
|
|
13
|
+
import { parameters as languageAndGrammarParameters } from './Language and grammar.mdx';
|
|
14
|
+
import { parameters as linkingParameters } from './Linking.mdx';
|
|
15
|
+
import { parameters as referencingCodeParameters } from './Referencing code.mdx';
|
|
16
|
+
import { parameters as storiesParameters } from './Stories/About.mdx';
|
|
17
|
+
|
|
18
|
+
export const parameters = {
|
|
19
|
+
id: 'Meta/Gamut writing guide',
|
|
20
|
+
title: 'Gamut writing guide',
|
|
21
|
+
subtitle:
|
|
22
|
+
'Guidelines and standards for creating consistent, clear, and effective documentation.',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
<Meta title="Meta/Gamut writing guide/About" />
|
|
26
|
+
|
|
27
|
+
<AboutHeader {...parameters} />
|
|
28
|
+
|
|
29
|
+
Welcome to the Gamut writing guide! Thanks for taking the time to learn about our documentation standards. This guide helps keep our documentation clear, consistent, and useful across the Gamut design system.
|
|
30
|
+
|
|
31
|
+
The <LinkTo id="Meta/Gamut writing guide/General principles">General principles</LinkTo> is a great place to get an overview of our documentation philosophy and best practices. For specific topics like formatting, code documentation, or writing Storybook stories, check out the other pages below.
|
|
32
|
+
|
|
33
|
+
<TableOfContents
|
|
34
|
+
links={addParentPath(parameters.id, [
|
|
35
|
+
generalPrinciplesParameters,
|
|
36
|
+
documentationInCodeParameters,
|
|
37
|
+
formattingParameters,
|
|
38
|
+
languageAndGrammarParameters,
|
|
39
|
+
linkingParameters,
|
|
40
|
+
referencingCodeParameters,
|
|
41
|
+
storiesParameters,
|
|
42
|
+
])}
|
|
43
|
+
/>
|