@codecademy/styleguide 79.0.1-alpha.df213b.0 → 79.0.1-alpha.fd2a28.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/Markdown.tsx +1 -0
- package/CHANGELOG.md +1 -1
- package/package.json +2 -2
- 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 +4 -16
- package/src/lib/Molecules/Popover/Popover.stories.tsx +6 -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 -33
- package/src/lib/Foundations/System/Props/Color.mdx +0 -28
- 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 -28
- package/src/lib/Foundations/System/Props/Typography.mdx +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [79.0.1-alpha.
|
|
6
|
+
### [79.0.1-alpha.fd2a28.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.0.1-alpha.fd2a28.0) (2026-01-29)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @codecademy/styleguide
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/styleguide",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "79.0.1-alpha.
|
|
4
|
+
"version": "79.0.1-alpha.fd2a28.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": "4ab9cadb58e22b1a618151cca1a03fed8ee67546"
|
|
12
12
|
}
|
|
@@ -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,31 +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 styled from '@emotion/styled';
|
|
13
11
|
import kebabCase from 'lodash/kebabCase';
|
|
14
12
|
|
|
15
13
|
import { Code, ColorScale, LinkTo, TokenTable } from '~styleguide/blocks';
|
|
16
14
|
|
|
17
15
|
import { applyCorrectNotation } from './applyCorrectNotation';
|
|
18
16
|
|
|
19
|
-
const AnchorCode = styled(Code)(
|
|
20
|
-
css({
|
|
21
|
-
textDecoration: 'underline',
|
|
22
|
-
mx: 4,
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
|
|
26
17
|
export const PROP_COLUMN = {
|
|
27
18
|
key: 'key',
|
|
28
19
|
name: 'Prop',
|
|
29
|
-
size: '
|
|
20
|
+
size: 'md',
|
|
30
21
|
render: ({ id }: any) => <Code>{id}</Code>,
|
|
31
22
|
};
|
|
32
23
|
|
|
@@ -425,14 +416,11 @@ const PROPERTIES_COLUMN = {
|
|
|
425
416
|
}) =>
|
|
426
417
|
properties.map((property) => (
|
|
427
418
|
<Anchor
|
|
428
|
-
href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${
|
|
429
|
-
property
|
|
430
|
-
)}`}
|
|
431
|
-
key={property}
|
|
419
|
+
href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${property}`}
|
|
432
420
|
rel=""
|
|
433
421
|
target="_blank"
|
|
434
422
|
>
|
|
435
|
-
<
|
|
423
|
+
<Code key={property}>{kebabCase(property)}</Code>
|
|
436
424
|
</Anchor>
|
|
437
425
|
)),
|
|
438
426
|
};
|
|
@@ -442,7 +430,7 @@ const SCALE_COLUMN = {
|
|
|
442
430
|
name: 'Scale',
|
|
443
431
|
size: 'lg',
|
|
444
432
|
render: ({ scale }: { scale: string }) => (
|
|
445
|
-
<LinkTo id=
|
|
433
|
+
<LinkTo id={`foundations-theme--${kebabCase(scale)}`}>{scale}</LinkTo>
|
|
446
434
|
),
|
|
447
435
|
};
|
|
448
436
|
|
|
@@ -80,6 +80,7 @@ export const Above: Story = {
|
|
|
80
80
|
export const Below: Story = {
|
|
81
81
|
render: (args) => <PopoverExample {...args} beak="center" position="below" />,
|
|
82
82
|
};
|
|
83
|
+
|
|
83
84
|
export const CenterLeft: Story = {
|
|
84
85
|
render: (args) => (
|
|
85
86
|
<PopoverExample
|
|
@@ -113,6 +114,7 @@ export const PopoverCheckerDense: Story = {
|
|
|
113
114
|
/>
|
|
114
115
|
),
|
|
115
116
|
};
|
|
117
|
+
|
|
116
118
|
export const PopoverCheckerLoose: Story = {
|
|
117
119
|
render: (args) => (
|
|
118
120
|
<PopoverExample
|
|
@@ -122,6 +124,7 @@ export const PopoverCheckerLoose: Story = {
|
|
|
122
124
|
/>
|
|
123
125
|
),
|
|
124
126
|
};
|
|
127
|
+
|
|
125
128
|
export const PopoverCheckerRegular: Story = {
|
|
126
129
|
render: (args) => (
|
|
127
130
|
<PopoverExample
|
|
@@ -131,6 +134,7 @@ export const PopoverCheckerRegular: Story = {
|
|
|
131
134
|
/>
|
|
132
135
|
),
|
|
133
136
|
};
|
|
137
|
+
|
|
134
138
|
export const PopoverDiagonalADense: Story = {
|
|
135
139
|
render: (args) => (
|
|
136
140
|
<PopoverExample
|
|
@@ -140,6 +144,7 @@ export const PopoverDiagonalADense: Story = {
|
|
|
140
144
|
/>
|
|
141
145
|
),
|
|
142
146
|
};
|
|
147
|
+
|
|
143
148
|
export const PopoverDiagonalALoose: Story = {
|
|
144
149
|
render: (args) => (
|
|
145
150
|
<PopoverExample
|
|
@@ -149,6 +154,7 @@ export const PopoverDiagonalALoose: Story = {
|
|
|
149
154
|
/>
|
|
150
155
|
),
|
|
151
156
|
};
|
|
157
|
+
|
|
152
158
|
export const PopoverDiagonalARegular: Story = {
|
|
153
159
|
render: (args) => (
|
|
154
160
|
<PopoverExample
|
|
@@ -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,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} />
|
|
@@ -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,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: 'Space',
|
|
9
|
-
subtitle: 'Props for maintaining specific vertical and horizontal rhythms',
|
|
10
|
-
status: 'updating',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
<Meta title="Foundations/System/Props/Space" />
|
|
14
|
-
|
|
15
|
-
<AboutHeader {...parameters} />
|
|
16
|
-
|
|
17
|
-
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.
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import styled from '@emotion/styled';
|
|
21
|
-
import { system } from '@codecademy/gamut-styles';
|
|
22
|
-
|
|
23
|
-
const SpaceExample = styled.div(system.space);
|
|
24
|
-
|
|
25
|
-
<SpaceExample p={8} my={[16, 24, 32]} />;
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
<TokenTable rows={getPropRows('space')} 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: 'Typography',
|
|
9
|
-
subtitle: 'Props for text manipulation',
|
|
10
|
-
status: 'current',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
<Meta title="Foundations/System/Props/Typography" />
|
|
14
|
-
|
|
15
|
-
<AboutHeader {...parameters} />
|
|
16
|
-
|
|
17
|
-
Typography props give you fine-grained control over text styling and appearance. These properties connect to the theme's typography scales for font families, sizes, weights, and line heights, making it simple to maintain typographic consistency across your application while allowing for custom text transformations and decorations.
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import styled from '@emotion/styled';
|
|
21
|
-
import { system } from '@codecademy/gamut-styles';
|
|
22
|
-
|
|
23
|
-
const TextExample = styled.p(system.typography);
|
|
24
|
-
|
|
25
|
-
<TextExample fontSize={16} fontFamily="accent" textTransform="uppercase" />;
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
<TokenTable rows={getPropRows('typography')} columns={defaultColumns} />
|