Skip to content

Commit 9ba35e0

Browse files
committed
make example more realistic, fix sizing
1 parent 765fbe0 commit 9ba35e0

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

packages/@react-spectrum/s2/src/TextField.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {TextArea as AriaTextArea, TextAreaContext as AriaTextAreaContext} from '
1414
import {TextContext as AriaTextContext} from 'react-aria-components/Text';
1515
import {TextField as AriaTextField, TextFieldProps as AriaTextFieldProps} from 'react-aria-components/TextField';
1616
import {centerBaseline} from './CenterBaseline';
17-
import {centerPadding, style} from '../style' with {type: 'macro'};
17+
import {centerPadding, fontRelative, style} from '../style' with {type: 'macro'};
1818
import {composeRenderProps} from 'react-aria-components/composeRenderProps';
1919
import {ContextValue, DEFAULT_SLOT, Provider, useSlottedContext} from 'react-aria-components/slots';
2020
import {controlSize, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};
@@ -150,6 +150,7 @@ export const TextFieldBase = forwardRef(function TextFieldBase(props: TextFieldP
150150
[IconContext, {
151151
render: centerBaseline({}),
152152
styles: style({
153+
size: fontRelative(20),
153154
'--iconPrimary': {
154155
type: 'fill',
155156
value: 'currentColor'

packages/@react-spectrum/s2/stories/TextField.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {Content, Footer, Heading, Text} from '../src/Content';
1515
import {ContextualHelp} from '../src/ContextualHelp';
1616
import {Form} from '../src/Form';
1717
import {Link} from '../src/Link';
18-
import Magnifier from '../s2wf-icons/S2_Icon_Search_20_N.svg';
18+
import MentionIcon from '../s2wf-icons/S2_Icon_Mention_20_N.svg';
1919
import type {Meta, StoryObj} from '@storybook/react';
2020
import {style} from '../style' with {type: 'macro'};
2121
import {TextArea, TextField} from '../src/TextField';
@@ -180,7 +180,7 @@ export const TextFieldWithAddons: StoryTextField = {
180180
<Form>
181181
<TextField {...args} label="Phone Number" prefix="#" placeholder="(000) 000-0000" />
182182
<TextField {...args} label="URL" prefix="https://" placeholder="example.com" />
183-
<TextField {...args} label="Search" prefix={<Magnifier />} placeholder="Search phrase" />
183+
<TextField {...args} label="Mention" prefix={<MentionIcon />} placeholder="username" />
184184
<Button type="submit" variant="primary">Submit</Button>
185185
</Form>
186186
),
@@ -194,7 +194,7 @@ export const TextAreaWithAddons: StoryTextArea = {
194194
render: (args) => (
195195
<Form>
196196
<TextArea {...args} label="Phone Number" prefix="#" placeholder="(000) 000-0000" />
197-
<TextArea {...args} label="Search" prefix={<Magnifier />} placeholder="Search phrase" />
197+
<TextArea {...args} label="Mention" prefix={<MentionIcon />} placeholder="username" />
198198
<Button type="submit" variant="primary">Submit</Button>
199199
</Form>
200200
),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ Use the `prefix` prop to display a prefix in the text area. Either a string or w
5757
```tsx render
5858
"use client";
5959
import {TextArea} from '@react-spectrum/s2/TextArea';
60-
import Magnifier from '@react-spectrum/s2/icons/Search';
60+
import MentionIcon from '@react-spectrum/s2/icons/Mention';
6161
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
6262

6363
function Example() {
6464
return (
6565
<div className={style({display: 'flex', flexDirection: 'column', gap: 8})}>
6666
<TextArea label="Irrational number" prefix="#" placeholder="3.1415926535897932384626433832795028841971" />
67-
<TextArea label="Search" prefix={<Magnifier />} placeholder="Search phrase" />
67+
<TextArea label="Mention" prefix={<MentionIcon />} placeholder="username" />
6868
</div>
6969
);
7070
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ Use the `prefix` prop to display a prefix in the text field. Either a string or
5757
```tsx render
5858
"use client";
5959
import {TextField} from '@react-spectrum/s2/TextField';
60-
import Magnifier from '@react-spectrum/s2/icons/Search';
60+
import MentionIcon from '@react-spectrum/s2/icons/Mention';
6161
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
6262

6363
function Example() {
6464
return (
6565
<div className={style({display: 'flex', flexDirection: 'column', gap: 8})}>
6666
<TextField label="Phone Number" prefix="#" placeholder="(000) 000-0000" type="tel" />
6767
<TextField label="URL" prefix="https://" placeholder="example.com" />
68-
<TextField label="Search" prefix={<Magnifier />} placeholder="Search phrase" />
68+
<TextField label="Mention" prefix={<MentionIcon />} placeholder="username" />
6969
</div>
7070
);
7171
}

0 commit comments

Comments
 (0)