Skip to content

Commit ddb47f6

Browse files
committed
Add sizing guide with XScale component and metadata; update spacing overview
1 parent 4c396b6 commit ddb47f6

9 files changed

Lines changed: 86 additions & 9 deletions

File tree

internal

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import ExpandContent from '~/internal/components/ExpandContent'
2+
3+
export default () => {
4+
return (
5+
<figure>
6+
<ExpandContent>
7+
<div className='doc-table'>
8+
<table>
9+
<thead>
10+
<tr>
11+
<th>Token</th>
12+
<th>Pixels</th>
13+
<th>REM</th>
14+
<th>Representation</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
{
19+
Array.from({ length: 32 }, (_, index) => ({
20+
token: `${index + 1}x`,
21+
px: `${(index + 1) * 4}px`,
22+
value: `${(index + 1) * 0.25}rem`,
23+
}))
24+
.map((row, index) => (
25+
<tr key={index}>
26+
<th>{row.token}</th>
27+
<td>{row.px}</td>
28+
<td>{row.value}</td>
29+
<td>
30+
<div className='inline-block bg:primary h:1em v:middle' style={{ width: row.value }}></div>
31+
</td>
32+
</tr>
33+
))
34+
}
35+
<tr>
36+
<td colSpan={4}>...</td>
37+
</tr>
38+
</tbody>
39+
</table>
40+
</div>
41+
</ExpandContent>
42+
</figure>
43+
)
44+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Overview [sr-only]
2+
<XScale />
3+
```html
4+
<!-- @MARK 6x -->
5+
<div class="size:6x">24px, width: 1.5rem; height: 1.5rem</div>
6+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import define from 'internal/utils/metadata'
2+
3+
const metadata = define({
4+
title: 'Sizing',
5+
description: 'A guide to the sizing system and how to apply it in your project.',
6+
category: 'Fundations',
7+
fileURL: import.meta.url
8+
})
9+
10+
export default metadata
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import createPage from '~/internal/factories/create-page'
2+
import Layout from 'internal/layouts/doc'
3+
import metadata from './metadata'
4+
import dictionaries from '~/site/dictionaries'
5+
import categories from '~/site/.categories/guide.json'
6+
7+
export const { Page, dynamic, revalidate, generateMetadata } = createPage({
8+
metadata,
9+
dictionaries,
10+
categories,
11+
content: import('./content.mdx'),
12+
Layout,
13+
})
14+
15+
export default Page

site/app/[locale]/guide/spacing/components/Overview.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export default () => {
88
<thead>
99
<tr>
1010
<th>Token</th>
11-
<th className='text:center'>Pixels</th>
12-
<th className='text:center'>REM</th>
11+
<th>Pixels</th>
12+
<th>REM</th>
1313
<th>Representation</th>
1414
</tr>
1515
</thead>
@@ -19,8 +19,8 @@ export default () => {
1919
.map(([key, value], index) => (
2020
<tr key={index}>
2121
<th>{key}</th>
22-
<td className='text:right'>{value}px</td>
23-
<td className='text:right'>{value / 16}rem</td>
22+
<td>{value}px</td>
23+
<td>{value / 16}rem</td>
2424
<td>
2525
<div className='inline-flex bg:stripe-pink w:fit outline:1|lighter outline-offset:-1 v:middle' style={{ gap: value / 16 + 'rem' }}>
2626
{Array.from({ length: 14 - index }, (_, index) => <div className='inline-block bg:base size:1.5em'></div>)}

site/app/[locale]/guide/spacing/content.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import XScale from '../sizing/components/XScale'
2+
13
## Overview [sr-only]
24
This spacing scale ranges from `4xs` to `5xl`, allowing fine-tuned control over both compact and expansive layouts.
35
<Overview />
@@ -59,9 +61,9 @@ Apply the custom spacing tokens in your markup:
5961

6062
---
6163

62-
## Using multiplier `x`
64+
## Using spacing multiplier
6365
The spacing system is grounded on a consistent and scalable design token foundation. It uses a [base unit](/guide/configuration#baseunit) of **4 pixels**, which acts as the smallest scalable measurement across your interface.
64-
66+
<XScale />
6567
Use the `x` suffix to indicate a multiplier of the base unit.
6668
```html
6769
<!-- @MARK 1x -->

site/app/[locale]/reference/border-color/components/FrameHeirs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { rules } from '@master/css'
44
export default () => <>
55
{
66
Object.keys(rules)
7-
.filter((ruleName) => (rules as any)[ruleName].variables?.find((variable: string) => variable.includes('frame')))
7+
.filter((ruleName) => (rules as any)[ruleName].namespaces?.find((variable: string) => variable.includes('frame')))
88
.map((ruleName, index, arr) =>
99
<Fragment key={ruleName}>
1010
<code>{ruleName}</code>

site/app/[locale]/reference/color/components/TextHeirs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { rules } from '@master/css'
44
export default () => <>
55
{
66
Object.keys(rules)
7-
.filter((ruleName) => (rules as any)[ruleName].variables?.find((variable: string) => variable.includes('text')))
7+
.filter((ruleName) => (rules as any)[ruleName].namespaces?.find((variable: string) => variable.includes('text')))
88
.map((ruleName, index, arr) =>
99
<Fragment key={ruleName}>
1010
<code>{ruleName}</code>

0 commit comments

Comments
 (0)