Skip to content

Commit eb0006c

Browse files
authored
docs: random docs improvements (#9048)
* user style macro in S2 docs where possible * update Picker selection prop usage * add icons to MarkdownMenu items * dynamic favicon based on library
1 parent 0836d3a commit eb0006c

26 files changed

+82
-41
lines changed
191 KB
Binary file not shown.
177 KB
Binary file not shown.

packages/dev/s2-docs/pages/s2/Calendar.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,15 @@ Use the `focusedValue` or `defaultFocusedValue` prop to control which date is fo
177177
"use client";
178178
import {Calendar, ActionButton} from '@react-spectrum/s2';
179179
import {CalendarDate, today, getLocalTimeZone} from '@internationalized/date';
180+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
180181
import {useState} from 'react';
181182

182183
function Example() {
183184
let defaultDate = new CalendarDate(2021, 7, 1);
184185
let [focusedDate, setFocusedDate] = useState(defaultDate);
185186

186187
return (
187-
<div style={{display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8}}>
188+
<div className={style({display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8})}>
188189
<ActionButton onPress={() => setFocusedDate(today(getLocalTimeZone()))}>
189190
Today
190191
</ActionButton>

packages/dev/s2-docs/pages/s2/CheckboxGroup.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Use the `name` prop to submit the selected checkboxes to the server. Set the `is
5757
```tsx render
5858
"use client";
5959
import {CheckboxGroup, Checkbox, Button, Form} from '@react-spectrum/s2';
60+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
6061

6162
<Form/* PROPS */>
6263
<CheckboxGroup
@@ -77,7 +78,7 @@ import {CheckboxGroup, Checkbox, Button, Form} from '@react-spectrum/s2';
7778
<Checkbox value="cookies" isRequired>Cookie policy</Checkbox>
7879
{/*- end highlight -*/}
7980
</CheckboxGroup>
80-
<Button type="submit" style={{marginTop: 8}}>Submit</Button>
81+
<Button type="submit" className={style({marginTop: 8})}>Submit</Button>
8182
</Form>
8283
```
8384

packages/dev/s2-docs/pages/s2/ColorArea.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The `onChange` event is called as the user drags, and `onChangeEnd` is called wh
2929
```tsx render
3030
"use client";
3131
import {ColorArea, parseColor} from '@react-spectrum/s2';
32+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
3233
import {useState} from 'react';
3334

3435
function Example() {
@@ -45,7 +46,7 @@ function Example() {
4546
onChange={setCurrentValue}
4647
onChangeEnd={setFinalValue} />
4748
{/*- end highlight -*/}
48-
<pre style={{fontSize: 12}}>
49+
<pre className={style({font: 'body'})}>
4950
onChange value: {currentValue.toString('hex')}{'\n'}
5051
onChangeEnd value: {finalValue.toString('hex')}
5152
</pre>

packages/dev/s2-docs/pages/s2/ColorField.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Use the `value` or `defaultValue` prop to set the color value, and `onChange` to
2828
import {ColorField} from '@react-spectrum/s2';
2929
import {useState} from 'react';
3030
import {parseColor} from '@react-stately/color';
31+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
3132

3233
function Example() {
3334
let [value, setValue] = useState(parseColor('#e73623'));
@@ -39,7 +40,7 @@ function Example() {
3940
placeholder="Enter a color"
4041
value={value}
4142
onChange={setValue} />
42-
<pre style={{fontSize: 12}}>Current value: {value.toString('hex')}</pre>
43+
<pre className={style({font: 'body'})}>Current value: {value.toString('hex')}</pre>
4344
</div>
4445
);
4546
}
@@ -52,13 +53,14 @@ By default, ColorField displays a hex value. Set the `colorSpace` and `channel`
5253
```tsx render
5354
"use client";
5455
import {ColorField, parseColor} from '@react-spectrum/s2';
56+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
5557
import {useState} from 'react';
5658

5759
function Example() {
5860
let [color, setColor] = useState(parseColor('#7f007f'));
5961

6062
return (
61-
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
63+
<div className={style({ display: 'flex', flexDirection: 'column', gap: 8 })}>
6264
<ColorField
6365
label="Hue"
6466
placeholder="Select a hue"
@@ -82,7 +84,7 @@ function Example() {
8284
onChange={setColor}
8385
colorSpace="hsl"
8486
channel="lightness" />
85-
<pre style={{fontSize: 12}}>Current value: {color?.toString('hex')}</pre>
87+
<pre className={style({font: 'body'})}>Current value: {color?.toString('hex')}</pre>
8688
</div>
8789
);
8890
}

packages/dev/s2-docs/pages/s2/ColorSlider.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The `onChange` event is called as the user drags, and `onChangeEnd` is called wh
2828
```tsx render
2929
"use client";
3030
import {ColorSlider, parseColor} from '@react-spectrum/s2';
31+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
3132
import {useState} from 'react';
3233

3334
function Example() {
@@ -43,7 +44,7 @@ function Example() {
4344
onChange={setCurrentValue}
4445
onChangeEnd={setFinalValue} />
4546
{/*- end highlight -*/}
46-
<pre style={{fontSize: 12}}>
47+
<pre className={style({font: 'body'})}>
4748
onChange value: {currentValue.toString('hex')}{'\n'}
4849
onChangeEnd value: {finalValue.toString('hex')}
4950
</pre>

packages/dev/s2-docs/pages/s2/ColorSwatch.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ A ColorSwatch displays a color value passed via the `color` prop. The value can
2525
```tsx render
2626
"use client";
2727
import {ColorSwatch} from '@react-spectrum/s2';
28+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
2829

29-
<div style={{display: 'flex', gap: 12, alignItems: 'center'}}>
30+
<div className={style({display: 'flex', gap: 12, alignItems: 'center'})}>
3031
<ColorSwatch color="#ff6600" />
3132
<ColorSwatch color="rgb(255, 0, 255)" />
3233
<ColorSwatch color="hsl(120, 100%, 42%)" />

packages/dev/s2-docs/pages/s2/ColorSwatchPicker.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Use the `value` or `defaultValue` prop to set the selected color, and `onChange`
3030
```tsx render
3131
"use client";
3232
import {ColorSwatchPicker, ColorSwatch, parseColor} from '@react-spectrum/s2';
33+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
3334
import {useState} from 'react';
3435

3536
function Example() {
@@ -48,7 +49,7 @@ function Example() {
4849
<ColorSwatch color="#8b5cf6" />
4950
<ColorSwatch color="#ec4899" />
5051
</ColorSwatchPicker>
51-
<pre style={{fontSize: 12}}>Selected color: {value.toString('rgb')}</pre>
52+
<pre className={style({font: 'body'})}>Selected color: {value.toString('rgb')}</pre>
5253
</>
5354
);
5455
}

packages/dev/s2-docs/pages/s2/ColorWheel.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The `onChange` event is called as the user drags, and `onChangeEnd` is called wh
2929
import {ColorWheel} from '@react-spectrum/s2';
3030
import {useState} from 'react';
3131
import {parseColor} from '@react-stately/color';
32+
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
3233

3334
function Example() {
3435
let [currentValue, setCurrentValue] = useState(parseColor('hsl(50, 100%, 50%)'));
@@ -42,7 +43,7 @@ function Example() {
4243
onChange={setCurrentValue}
4344
onChangeEnd={setFinalValue} />
4445
{/*- end highlight -*/}
45-
<pre style={{fontSize: 12}}>
46+
<pre className={style({font: 'body'})}>
4647
onChange value: {currentValue.toString('hex')}{'\n'}
4748
onChangeEnd value: {finalValue.toString('hex')}
4849
</pre>

0 commit comments

Comments
 (0)