@codecademy/styleguide 79.0.1-alpha.470613.0 → 79.0.1-alpha.4746be.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/preview.ts +0 -12
- package/.storybook/theming/GamutThemeProvider.tsx +0 -4
- package/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/src/lib/Foundations/System/Props/Border.mdx +23 -3
- package/src/lib/Foundations/System/Props/Border.stories.tsx +138 -0
- package/src/lib/Foundations/System/Props/Color.mdx +17 -3
- package/src/lib/Foundations/System/Props/Color.stories.tsx +47 -0
package/.storybook/preview.ts
CHANGED
|
@@ -177,18 +177,6 @@ export const globalTypes = {
|
|
|
177
177
|
showName: true,
|
|
178
178
|
},
|
|
179
179
|
},
|
|
180
|
-
direction: {
|
|
181
|
-
name: 'Direction',
|
|
182
|
-
description: 'Text direction for the page',
|
|
183
|
-
defaultValue: 'ltr',
|
|
184
|
-
toolbar: {
|
|
185
|
-
items: [
|
|
186
|
-
{ value: 'ltr', icon: 'arrowright', title: 'Left-To-Right' },
|
|
187
|
-
{ value: 'rtl', icon: 'arrowleft', title: 'Right-To-Left' },
|
|
188
|
-
],
|
|
189
|
-
showName: true,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
180
|
};
|
|
193
181
|
|
|
194
182
|
export const decorators = [withEmotion];
|
|
@@ -35,7 +35,6 @@ type GlobalsContext = {
|
|
|
35
35
|
colorMode: 'light' | 'dark';
|
|
36
36
|
theme: keyof typeof themeMap;
|
|
37
37
|
logicalProps: 'true' | 'false';
|
|
38
|
-
direction: 'ltr' | 'rtl';
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
|
|
@@ -43,7 +42,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
43
42
|
const colorMode = context.globals.colorMode ?? 'light';
|
|
44
43
|
const selectedTheme = context.globals.theme;
|
|
45
44
|
const useLogicalProperties = context.globals.logicalProps !== 'false';
|
|
46
|
-
const direction = context.globals.direction ?? 'ltr';
|
|
47
45
|
const background = corePalette[themeBackground[colorMode]];
|
|
48
46
|
const storyRef = useRef<HTMLDivElement>(null);
|
|
49
47
|
const currentTheme = themeMap[selectedTheme];
|
|
@@ -68,7 +66,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
68
66
|
alwaysSetVariables
|
|
69
67
|
bg={themeBackground[colorMode]}
|
|
70
68
|
ref={storyRef}
|
|
71
|
-
dir={direction}
|
|
72
69
|
>
|
|
73
70
|
{Story()}
|
|
74
71
|
</Background>
|
|
@@ -86,7 +83,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
86
83
|
alwaysSetVariables
|
|
87
84
|
bg={themeBackground[colorMode]}
|
|
88
85
|
ref={storyRef}
|
|
89
|
-
dir={direction}
|
|
90
86
|
>
|
|
91
87
|
{Story()}
|
|
92
88
|
</Background>
|
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.4746be.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.0.1-alpha.4746be.0) (2026-02-06)
|
|
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.4746be.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": "cb33dc6a45070d633af69f28a74cb3e059cd8fab"
|
|
12
12
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
3
|
+
import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
+
import * as BorderStories from './Border.stories';
|
|
6
7
|
|
|
7
8
|
export const parameters = {
|
|
8
9
|
title: 'Border',
|
|
@@ -10,7 +11,7 @@ export const parameters = {
|
|
|
10
11
|
status: 'updating',
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
<Meta title="Foundations/System/Props/Border" />
|
|
14
|
+
<Meta of={BorderStories} title="Foundations/System/Props/Border" />
|
|
14
15
|
|
|
15
16
|
<AboutHeader {...parameters} />
|
|
16
17
|
|
|
@@ -30,4 +31,23 @@ const BorderExample = styled.div(system.border);
|
|
|
30
31
|
/>;
|
|
31
32
|
```
|
|
32
33
|
|
|
34
|
+
These border props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
|
|
35
|
+
|
|
36
|
+
<Callout
|
|
37
|
+
text={
|
|
38
|
+
<>
|
|
39
|
+
You can use the <strong>LogicalProps</strong> button in the toolbar to
|
|
40
|
+
switch between modes.
|
|
41
|
+
</>
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
<Canvas of={BorderStories.DirectionalBorderExample} />
|
|
46
|
+
|
|
47
|
+
<Canvas of={BorderStories.BorderWidthExample} />
|
|
48
|
+
|
|
49
|
+
<Canvas of={BorderStories.BorderRadiusExample} />
|
|
50
|
+
|
|
51
|
+
<Canvas of={BorderStories.BorderStyleExample} />
|
|
52
|
+
|
|
33
53
|
<TokenTable rows={getPropRows('border')} columns={defaultColumns} />
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Box, FlexBox, Markdown } from '@codecademy/gamut';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Box> = {
|
|
5
|
+
title: 'Foundations/System/Props/Border',
|
|
6
|
+
component: Box,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Box>;
|
|
11
|
+
|
|
12
|
+
export const DirectionalBorderExample: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<FlexBox gap={16} row>
|
|
15
|
+
<Box
|
|
16
|
+
bg="background-selected"
|
|
17
|
+
borderX={2}
|
|
18
|
+
borderY={1}
|
|
19
|
+
p={16}
|
|
20
|
+
textAlign="center"
|
|
21
|
+
>
|
|
22
|
+
This box has <Markdown text="`borderX={2}`, `borderY={1}`." /> Inspect
|
|
23
|
+
the example to see what CSS properties are rendered based on the logical
|
|
24
|
+
properties mode.
|
|
25
|
+
</Box>
|
|
26
|
+
<Box
|
|
27
|
+
bg="background-selected"
|
|
28
|
+
borderLeft={2}
|
|
29
|
+
borderRight={1}
|
|
30
|
+
p={16}
|
|
31
|
+
textAlign="center"
|
|
32
|
+
>
|
|
33
|
+
This box has <Markdown text="`borderLeft={2}`, `borderRight={1}`." />{' '}
|
|
34
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
35
|
+
logical properties mode.
|
|
36
|
+
</Box>
|
|
37
|
+
</FlexBox>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const BorderWidthExample: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<FlexBox gap={16} row>
|
|
44
|
+
<Box
|
|
45
|
+
bg="background-selected"
|
|
46
|
+
border={1}
|
|
47
|
+
borderWidthX="4px"
|
|
48
|
+
borderWidthY="10px"
|
|
49
|
+
p={16}
|
|
50
|
+
textAlign="center"
|
|
51
|
+
>
|
|
52
|
+
This box has{' '}
|
|
53
|
+
<Markdown text="`borderWidthX='4px'` and `borderWidthY='10px'`." />{' '}
|
|
54
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
55
|
+
logical properties mode.
|
|
56
|
+
</Box>
|
|
57
|
+
<Box
|
|
58
|
+
bg="background-selected"
|
|
59
|
+
border={1}
|
|
60
|
+
borderWidthRight="10px"
|
|
61
|
+
borderWidthTop="4px"
|
|
62
|
+
p={16}
|
|
63
|
+
textAlign="center"
|
|
64
|
+
>
|
|
65
|
+
This box has{' '}
|
|
66
|
+
<Markdown text="`borderWidthTop='4px'` and `borderWidthRight='10px'`." />{' '}
|
|
67
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
68
|
+
logical properties mode.
|
|
69
|
+
</Box>
|
|
70
|
+
</FlexBox>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const BorderRadiusExample: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<FlexBox gap={16} row>
|
|
77
|
+
<Box
|
|
78
|
+
bg="background-selected"
|
|
79
|
+
border={1}
|
|
80
|
+
borderRadiusLeft="lg"
|
|
81
|
+
borderRadiusRight="none"
|
|
82
|
+
p={16}
|
|
83
|
+
textAlign="center"
|
|
84
|
+
>
|
|
85
|
+
This box has{' '}
|
|
86
|
+
<Markdown text="`borderRadiusLeft='lg'` and `borderRadiusRight='none'`." />{' '}
|
|
87
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
88
|
+
logical properties mode.
|
|
89
|
+
</Box>
|
|
90
|
+
<Box
|
|
91
|
+
bg="background-selected"
|
|
92
|
+
border={1}
|
|
93
|
+
borderRadiusBottomLeft="xl"
|
|
94
|
+
borderRadiusTopRight="xl"
|
|
95
|
+
p={16}
|
|
96
|
+
textAlign="center"
|
|
97
|
+
>
|
|
98
|
+
This box has{' '}
|
|
99
|
+
<Markdown text="`borderRadiusTopRight='xl'` and `borderRadiusBottomLeft='xl'`." />{' '}
|
|
100
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
101
|
+
logical properties mode.
|
|
102
|
+
</Box>
|
|
103
|
+
</FlexBox>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const BorderStyleExample: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<FlexBox gap={16} row>
|
|
110
|
+
<Box
|
|
111
|
+
bg="background-selected"
|
|
112
|
+
border={1}
|
|
113
|
+
borderStyleX="dashed"
|
|
114
|
+
borderStyleY="dotted"
|
|
115
|
+
p={16}
|
|
116
|
+
textAlign="center"
|
|
117
|
+
>
|
|
118
|
+
This box has{' '}
|
|
119
|
+
<Markdown text="`borderStyleX='dashed'` and `borderStyleY='dotted'`." />{' '}
|
|
120
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
121
|
+
logical properties mode.
|
|
122
|
+
</Box>
|
|
123
|
+
<Box
|
|
124
|
+
bg="background-selected"
|
|
125
|
+
border={1}
|
|
126
|
+
borderStyleBottom="dotted"
|
|
127
|
+
borderStyleLeft="dashed"
|
|
128
|
+
p={16}
|
|
129
|
+
textAlign="center"
|
|
130
|
+
>
|
|
131
|
+
This box has{' '}
|
|
132
|
+
<Markdown text="`borderStyleBottom='dotted'` and `borderStyleLeft='dashed'`." />{' '}
|
|
133
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
134
|
+
logical properties mode.
|
|
135
|
+
</Box>
|
|
136
|
+
</FlexBox>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
3
|
+
import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
+
import * as ColorStories from './Color.stories';
|
|
6
7
|
|
|
7
8
|
export const parameters = {
|
|
8
9
|
title: 'Color',
|
|
@@ -10,7 +11,7 @@ export const parameters = {
|
|
|
10
11
|
status: 'current',
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
<Meta title="Foundations/System/Props/Color" />
|
|
14
|
+
<Meta of={ColorStories} title="Foundations/System/Props/Color" />
|
|
14
15
|
|
|
15
16
|
<AboutHeader {...parameters} />
|
|
16
17
|
|
|
@@ -25,4 +26,17 @@ const ColorExample = styled.div(system.color);
|
|
|
25
26
|
<ColorExample bg="navy" textColor="gray-100" borderColor="blue" />;
|
|
26
27
|
```
|
|
27
28
|
|
|
29
|
+
These color props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
|
|
30
|
+
|
|
31
|
+
<Callout
|
|
32
|
+
text={
|
|
33
|
+
<>
|
|
34
|
+
You can use the <strong>LogicalProps</strong> button in the toolbar to
|
|
35
|
+
switch between modes.
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<Canvas of={ColorStories.BorderColorExample} />
|
|
41
|
+
|
|
28
42
|
<TokenTable rows={getPropRows('color')} columns={defaultColumns} />
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Box, FlexBox, Markdown } from '@codecademy/gamut';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Box> = {
|
|
5
|
+
title: 'Foundations/System/Props/Color',
|
|
6
|
+
component: Box,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Box>;
|
|
11
|
+
|
|
12
|
+
export const BorderColorExample: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<FlexBox gap={16} row>
|
|
15
|
+
<Box
|
|
16
|
+
bg="background-selected"
|
|
17
|
+
border={1}
|
|
18
|
+
borderColorX="feedback-success"
|
|
19
|
+
borderColorY="feedback-error"
|
|
20
|
+
borderWidth="4px"
|
|
21
|
+
p={16}
|
|
22
|
+
textAlign="center"
|
|
23
|
+
>
|
|
24
|
+
This box has{' '}
|
|
25
|
+
<Markdown text="`borderColorX='feedback-success'` and `borderColorY='feedback-error'`." />{' '}
|
|
26
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
27
|
+
logical properties mode.
|
|
28
|
+
</Box>
|
|
29
|
+
<Box
|
|
30
|
+
bg="background-selected"
|
|
31
|
+
border={1}
|
|
32
|
+
borderColorBottom="feedback-warning"
|
|
33
|
+
borderColorLeft="feedback-success"
|
|
34
|
+
borderColorRight="feedback-error"
|
|
35
|
+
borderColorTop="interface"
|
|
36
|
+
borderWidth="4px"
|
|
37
|
+
p={16}
|
|
38
|
+
textAlign="center"
|
|
39
|
+
>
|
|
40
|
+
This box has{' '}
|
|
41
|
+
<Markdown text="`borderColorBottom='feedback-warning'`, `borderColorLeft='feedback-success'`, `borderColorRight='feedback-error'`, and `borderColorTop='interface'`." />{' '}
|
|
42
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
43
|
+
logical properties mode.
|
|
44
|
+
</Box>
|
|
45
|
+
</FlexBox>
|
|
46
|
+
),
|
|
47
|
+
};
|