@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.
- package/.storybook/components/Elements/DocsContainer.tsx +0 -4
- package/.storybook/components/Elements/Markdown.tsx +1 -0
- package/.storybook/preview.ts +5 -15
- package/.storybook/theming/GamutThemeProvider.tsx +1 -7
- package/CHANGELOG.md +1 -1
- 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/Compose.mdx +1 -1
- package/src/lib/Foundations/System/Props.mdx +230 -0
- package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.mdx +3 -3
- package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.stories.tsx +0 -1
- package/src/lib/Foundations/shared/elements.tsx +19 -69
- package/src/lib/Meta/About.mdx +3 -3
- package/src/lib/Meta/MCP/About.mdx +28 -0
- package/src/lib/Meta/MCP/Code Connect.mdx +38 -0
- package/src/lib/Meta/MCP/Figma MCP.mdx +89 -0
- package/src/lib/Meta/Usage Guide.mdx +1 -6
- package/src/lib/Molecules/Alert/Alert.mdx +1 -1
- package/src/static/mcp/component_playground.png +0 -0
- package/src/static/mcp/component_with_code_connect.png +0 -0
- package/src/static/meta/toolbar.png +0 -0
- package/src/lib/Foundations/System/Props/About.mdx +0 -81
- package/src/lib/Foundations/System/Props/Background.mdx +0 -30
- package/src/lib/Foundations/System/Props/Border.mdx +0 -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 -45
- package/src/lib/Foundations/System/Props/Layout.stories.tsx +0 -47
- 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
|
@@ -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} />
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AboutHeader,
|
|
5
|
-
Callout,
|
|
6
|
-
Code,
|
|
7
|
-
ImageWrapper,
|
|
8
|
-
TokenTable,
|
|
9
|
-
} from '~styleguide/blocks';
|
|
10
|
-
|
|
11
|
-
export const parameters = {
|
|
12
|
-
id: 'Meta/Logical and physical CSS properties',
|
|
13
|
-
title: 'Logical and physical CSS properties',
|
|
14
|
-
subtitle:
|
|
15
|
-
'Understanding CSS logical and physical properties and how Gamut supports both modes.',
|
|
16
|
-
status: 'static',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
<Meta title="Meta/Logical and physical CSS properties" />
|
|
20
|
-
|
|
21
|
-
<AboutHeader {...parameters} />
|
|
22
|
-
|
|
23
|
-
## What are CSS logical properties?
|
|
24
|
-
|
|
25
|
-
CSS logical properties are a modern approach to styling that adapts to the writing mode and text direction of your content, rather than being tied to physical screen directions. More information can be found on[MDN: CSS Logical Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values)
|
|
26
|
-
|
|
27
|
-
### Physical Properties (Traditional)
|
|
28
|
-
|
|
29
|
-
Physical properties reference the physical dimensions of the viewport. For example:
|
|
30
|
-
|
|
31
|
-
- `margin-left`, `margin-right`, `margin-top`, `margin-bottom`
|
|
32
|
-
- `padding-left`, `padding-right`, `padding-top`, `padding-bottom`
|
|
33
|
-
|
|
34
|
-
These work well for left-to-right (LTR) languages but require manual overrides for right-to-left (RTL) languages like Arabic or Hebrew.
|
|
35
|
-
|
|
36
|
-
### Logical Properties (Modern)
|
|
37
|
-
|
|
38
|
-
Logical properties reference the flow of content:
|
|
39
|
-
|
|
40
|
-
- **Inline axis** (text direction): `margin-inline-start`, `margin-inline-end`
|
|
41
|
-
- **Block axis** (reading direction): `margin-block-start`, `margin-block-end`
|
|
42
|
-
|
|
43
|
-
## Using `useLogicalProperties` in Gamut
|
|
44
|
-
|
|
45
|
-
Gamut supports both physical and logical CSS properties through the `useLogicalProperties` prop on `GamutProvider`. This allows you to choose which mode your application uses. By default, `useLogicalProperties` is set to `true`, meaning Gamut will use logical CSS properties. If you want to use physical CSS properties, you have to set `useLogicalProperties` to `false`.
|
|
46
|
-
|
|
47
|
-
### Affected Props
|
|
48
|
-
|
|
49
|
-
Here are some examples of how physical and logical properties are affected by the `useLogicalProperties` prop:
|
|
50
|
-
|
|
51
|
-
<TokenTable
|
|
52
|
-
idKey="prop"
|
|
53
|
-
columns={[
|
|
54
|
-
{
|
|
55
|
-
key: 'prop',
|
|
56
|
-
name: 'Prop',
|
|
57
|
-
size: 'sm',
|
|
58
|
-
render: ({ prop }) => <Code>{prop}</Code>,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
key: 'physical',
|
|
62
|
-
name: 'Physical',
|
|
63
|
-
size: 'xl',
|
|
64
|
-
render: ({ physical }) =>
|
|
65
|
-
physical.map((p) => (
|
|
66
|
-
<>
|
|
67
|
-
<Code key={p}>{p}</Code>{' '}
|
|
68
|
-
</>
|
|
69
|
-
)),
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
key: 'logical',
|
|
73
|
-
name: 'Logical',
|
|
74
|
-
size: 'xl',
|
|
75
|
-
render: ({ logical }) =>
|
|
76
|
-
logical.map((l) => (
|
|
77
|
-
<>
|
|
78
|
-
<Code key={l}>{l}</Code>{' '}
|
|
79
|
-
</>
|
|
80
|
-
)),
|
|
81
|
-
},
|
|
82
|
-
]}
|
|
83
|
-
rows={[
|
|
84
|
-
{
|
|
85
|
-
prop: 'mx',
|
|
86
|
-
physical: ['margin-left', 'margin-right'],
|
|
87
|
-
logical: ['margin-inline-start', 'margin-inline-end'],
|
|
88
|
-
},
|
|
89
|
-
{ prop: 'mt', physical: ['margin-top'], logical: ['margin-block-start'] },
|
|
90
|
-
{
|
|
91
|
-
prop: 'py',
|
|
92
|
-
physical: ['padding-top', 'padding-bottom'],
|
|
93
|
-
logical: ['padding-block-start', 'padding-block-end'],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
prop: 'pb',
|
|
97
|
-
physical: ['padding-bottom'],
|
|
98
|
-
logical: ['padding-block-end'],
|
|
99
|
-
},
|
|
100
|
-
]}
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
<Callout
|
|
104
|
-
text={
|
|
105
|
-
<>
|
|
106
|
-
Props like <code>m</code> and <code>p</code> (which set all four sides at
|
|
107
|
-
once) are not affected by this setting, as the CSS <code>margin</code> and{' '}
|
|
108
|
-
<code>padding</code> shorthands work identically in both modes.
|
|
109
|
-
</>
|
|
110
|
-
}
|
|
111
|
-
/>
|
|
112
|
-
|
|
113
|
-
## Previewing in Storybook
|
|
114
|
-
|
|
115
|
-
You can toggle between logical and physical properties in Storybook using the **LogicalProps** toolbar button:
|
|
116
|
-
|
|
117
|
-
<ImageWrapper
|
|
118
|
-
src="./meta/toolbar.png"
|
|
119
|
-
alt="The Storybook toolbar with the LogicalProps toggle highlighted."
|
|
120
|
-
height="auto"
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
This allows you to preview how components render with either property mode without changing any code.
|