Skip to content

Commit d089b57

Browse files
author
chenyueban
committed
feat(Item): The icon of the Item is carried by a single prop. (#3)
#3
1 parent a75aa59 commit d089b57

17 files changed

Lines changed: 1097 additions & 377 deletions

File tree

packages/fluent-ui.com/gatsby-config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ module.exports = {
2424
start_url: `/`,
2525
background_color: `#0078d4`,
2626
theme_color: `#0078d4`,
27-
display: `fluent-ui`,
2827
icon: `src/images/gatsby-icon.png` // This path is relative to the root of the site.
2928
}
3029
},

packages/fluent-ui.com/src/components/docs/nav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const Nav = ({ data }: TemplateProps): React.ReactElement => {
136136
onClick={handleNavigation.bind(undefined, title, type)}
137137
style={{ paddingLeft: expanded ? 24 : 12 }}
138138
>
139-
<span>{title}</span>
139+
{title}
140140
</Item>
141141
)
142142
)}
@@ -185,7 +185,7 @@ const Nav = ({ data }: TemplateProps): React.ReactElement => {
185185
onClick={handleNavigation.bind(undefined, title, type)}
186186
style={{ paddingLeft: expanded ? 24 : 12 }}
187187
>
188-
<span>{title}</span>
188+
{title}
189189
</Item>
190190
)
191191
)}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Item
3+
components: Item
4+
type: DataDisplay
5+
---
6+
7+
# Item
8+
9+
<p class="description">Common component that can be used with multiple components.</p>
10+
11+
## Use alone
12+
13+
```jsx
14+
<Item icon={<Icon.Connected />}>
15+
hello
16+
</Item>
17+
```
18+
19+
## Use with other components
20+
21+
- Use with [`Navigation`](/components/navigation)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Item
3+
components: Item
4+
api: true
5+
---
6+
7+
## API
8+
9+
```
10+
import Item from '@fluent-ui/core/Item'
11+
// or
12+
import { Item } from '@fluent-ui/core'
13+
```
14+
15+
### Props
16+
17+
| Name | Type | Default | Description |
18+
| --- | --- | --- | --- |
19+
| id | string &or; number | | The uniquely identifies |
20+
| icon | React.ReactElement | | The icon displayed. |
21+
| children | React.ReactChild | | Display portion of text and other content. |
22+
| onClick | React.MouseEventHandler<HTMLDivElement> | | Set the handler to handle click event. |
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: ItemGroup
3+
components: ItemGroup
4+
type: DataDisplay
5+
---
6+
7+
# ItemGroup
8+
9+
<p class="description">Used for grouping and nesting of Item components.</p>
10+
11+
## Default
12+
13+
```jsx
14+
<Box>
15+
<Item icon={<Icon.Connected />}>
16+
Option 1
17+
</Item>
18+
<Item icon={<Icon.Connected />}>
19+
Option 2
20+
</Item>
21+
<Item icon={<Icon.Connected />}>
22+
Option 3
23+
</Item>
24+
<ItemGroup title="group" icon={<Icon.Connected />}>
25+
<Item>
26+
Option 4
27+
</Item>
28+
<Item>
29+
Option 5
30+
</Item>
31+
<ItemGroup title="group inside">
32+
<Item>
33+
Option 7
34+
</Item>
35+
<Item>
36+
Option 8
37+
</Item>
38+
<ItemGroup title="group inside">
39+
<Item>
40+
Option 9
41+
</Item>
42+
<Item>
43+
Option 10
44+
</Item>
45+
</ItemGroup>
46+
</ItemGroup>
47+
</ItemGroup>
48+
<Item>
49+
Option 6
50+
</Item>
51+
</Box>
52+
```
53+
54+
## Use with other components
55+
56+
- Use with [`Navigation`](/components/navigation#itemgroup)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: ItemGroup
3+
components: ItemGroup
4+
api: true
5+
---
6+
7+
## API
8+
9+
```
10+
import ItemGroup from '@fluent-ui/core/ItemGroup'
11+
// or
12+
import { ItemGroup } from '@fluent-ui/core'
13+
```
14+
15+
### Props
16+
17+
| Name | Type | Default | Description |
18+
| --- | --- | --- | --- |
19+
| children | React.ReactElement &or; React.ReactElement[] | | The content of the `ItemGroupGroup`. |
20+
| title | string | | The text displayed by the title. |
21+
| icon | React.ReactElement | | The icon displayed by the title. |

0 commit comments

Comments
 (0)