Skip to content

Commit

Permalink
fix(docs): cleanup warnings in docs (adobe#6857)
Browse files Browse the repository at this point in the history
* fix various docs warnings

* typo
  • Loading branch information
reidbarber committed Aug 21, 2024
1 parent a4d8b94 commit 7336849
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions packages/@react-aria/color/docs/useColorField.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The following examples show how to use the `ColorField` component created in the
By default, `ColorField` is uncontrolled. You can set a default value using the `defaultValue` prop.

```tsx example
<ColorField defaultValue="#7f007f" />
<ColorField aria-label="Color" defaultValue="#7f007f" />
```

### Controlled
Expand All @@ -124,7 +124,7 @@ function Example() {
let [color, setColor] = React.useState(parseColor('#7f007f'));
return (
<>
<ColorField value={color} onChange={setColor} />
<ColorField aria-label="Color" value={color} onChange={setColor} />
<p>Current color value: {color.toString('hex')}</p>
</>
);
Expand All @@ -137,8 +137,8 @@ A `ColorField` can be disabled using the `isDisabled` prop, and made read only u
The difference is that read only color fields are focusable but disabled color fields are not.

```tsx example
<ColorField defaultValue="#7f007f" isDisabled />
<ColorField defaultValue="#7f007f" isReadOnly />
<ColorField aria-label="Color" defaultValue="#7f007f" isDisabled />
<ColorField aria-label="Color" defaultValue="#7f007f" isReadOnly />
```

### HTML forms
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/dnd/docs/useDraggableCollection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ let getItems = (keys) => (

<ListBox aria-label="Adobe Apps" items={items} getItems={getItems} selectionMode="multiple">
{([id, item]) => (
<Item key={id}>
<Item key={id} textValue={item.name}>
<item.style>{item.name}</item.style>
</Item>
)}
Expand Down
8 changes: 4 additions & 4 deletions packages/@react-aria/dnd/docs/useDroppableCollection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ function Example() {
onRootDrop={onRootDrop}
onInsert={onInsert}>
{item => (
<Item>
<Item textValue={item.name}>
<div className="image-item">
<img src={item.url} />
<span>{item.name}</span>
Expand Down Expand Up @@ -813,7 +813,7 @@ function Example() {
///- end highlight -///
onRootDrop={onRootDrop}>
{item => (
<Item key={item.name}>
<Item key={item.name} textValue={item.name}>
<div className="dir-item">
{item.kind === 'directory' ? <Folder /> : <File />}
<span>{item.name}</span>
Expand Down Expand Up @@ -897,7 +897,7 @@ function Example() {
acceptedDragTypes={['image/png']}
onRootDrop={onRootDrop}>
{item => (
<Item>
<Item textValue={item.name}>
<div className="image-item">
<img src={item.url} />
<span>{item.name}</span>
Expand Down Expand Up @@ -1015,7 +1015,7 @@ function Example() {
getDropOperation={getDropOperation}
onDrop={onDrop}>
{item => (
<Item>
<Item textValue={item.name}>
<div className="dir-item">
<Folder />
<span>{item.name} ({item.contains} items)</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/gridlist/docs/useGridList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function ExampleList(props) {
return (
<List aria-label="Example dynamic collection List" selectionMode="multiple" items={rows} {...props}>
{item => (
<Item>
<Item textValue={item.name}>
{item.name}
<Button onPress={() => alert(`Info for ${item.name}...`)}>
Info
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/avatar/docs/Avatar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Sizes can either be one of the predefined avatar size variables, or a custom siz
```tsx example
<Flex gap="size-100" wrap>
{[50, 75, 100, 200, 300, 400, 500, 600, 700].map(size => (
<Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size={`avatar-size-${size}`} />
<Avatar key={size} src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size={`avatar-size-${size}`} />
))}
<Avatar src="https://i.imgur.com/kJOwAdv.png" alt="avatar with custom size" size={50} />
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/combobox/src/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const ComboBoxBase = React.forwardRef(function ComboBoxBase<T extends object>(pr
validationState={props.validationState || (isInvalid ? 'invalid' : null)}
ref={inputGroupRef} />
</Field>
{name && formValue === 'key' && <input type="hidden" name={name} value={state.selectedKey} />}
{name && formValue === 'key' && <input type="hidden" name={name} value={state.selectedKey ?? ''} />}
<Popover
state={state}
UNSAFE_style={style}
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/table/docs/TableView.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Basic usage of TableView, seen in the example above, shows the use of a static c

Columns and rows can be statically defined as children, or generated dynamically using a function based on the data passed to the `columns` or `items` prop respectively. Cells can also be statically defined as children, or generated dynamically based on the columns defined in the TableHeader.

Each column and row has a unique key defined by the data. In the example below, the `uid` property of the column object is used as the `key` for the Column element within the TableHeader. The `key` of each row element is implicitly defined by the id property of the row object. See [collections](../react-stately/collections.html#unique-keys) to learn more keys in dynamic collections.
Each column and row has a unique key defined by the data. In the example below, the `uid` property of the column object is used as the `key` for the Column element within the TableHeader. The `key` of each row element is implicitly defined by the id property of the row object. See [collections](../react-stately/collections.html#unique-keys) to learn more about keys in dynamic collections.

```tsx example
let columns = [
Expand Down
6 changes: 3 additions & 3 deletions packages/@react-spectrum/tabs/docs/Tabs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ Icons can also be used in `Tabs` in addition to a text label. Tabs use [Slots](.
```tsx example
<Tabs aria-label="History of Ancient Rome">
<TabList>
<Item key="FoR"><Bookmark /><Text>Founding of Rome</Text></Item>
<Item key="MaR"><Calendar /><Text>Monarchy and Republic</Text></Item>
<Item key="Emp"><Dashboard /><Text>Empire</Text></Item>
<Item key="FoR" textValue="FoR"><Bookmark /><Text>Founding of Rome</Text></Item>
<Item key="MaR" textValue="MaR"><Calendar /><Text>Monarchy and Republic</Text></Item>
<Item key="Emp" textValue="Emp"><Dashboard /><Text>Empire</Text></Item>
</TabList>
<TabPanels>
<Item key="FoR">
Expand Down

0 comments on commit 7336849

Please sign in to comment.