Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 9cd7d54

Browse files
authored
feat(List): add proper support for children API (#2207)
* Prototype: Context usage for collections * revert changes * add UTs * fix UTs, create default * improve UTs, types * apply review comments * prettify fixes * feat(hooks): add useAutoControlled() hook * add docs * use autoControlled hook * fix review comment * fix deps * fix version * add changelog * fix perf tests
1 parent 35aaf02 commit 9cd7d54

27 files changed

+1131
-110
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3737
### Features
3838
- Added sourcemaps to the dist output to simplify debugging @miroslavstastny ([#2329](https://github.com/microsoft/fluent-ui-react/pull/2329))
3939
- Adding 'expand', 'collapse', 'companion', 'share-to' and 'settings-audio' icons @TanelVari ([#2343](https://github.com/microsoft/fluent-ui-react/pull/2343))
40+
- Add support for Children API in `List` component @layershifter ([#2207](https://github.com/microsoft/fluent-ui-react/pull/2207))
4041

4142
### Performance
4243
- Add styles caching when there aren't inline overrides defined @mnajdova ([#2309](https://github.com/microsoft/fluent-ui-react/pull/2309))

docs/src/examples/components/List/Content/ListExampleContent.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ import { List } from '@fluentui/react'
33

44
const ListExample = () => (
55
<List>
6-
<List.Item header="Program the sensor to the SAS alarm through the haptic SQL card!" />
7-
<List.Item header="Use the online FTP application to input the multi-byte application!" />
8-
<List.Item header="The GB pixel is down, navigate the virtual interface!" />
6+
<List.Item
7+
header="Program the sensor to the SAS alarm through the haptic SQL card!"
8+
index={0}
9+
/>
10+
<List.Item
11+
header="Use the online FTP application to input the multi-byte application!"
12+
index={1}
13+
/>
14+
<List.Item header="The GB pixel is down, navigate the virtual interface!" index={2} />
915
</List>
1016
)
1117

docs/src/examples/components/List/Content/ListExampleContentMedia.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ const ListExample = () => (
66
<List.Item
77
content="Program the sensor to the SAS alarm through the haptic SQL card!"
88
contentMedia="7:26:56 AM"
9+
index={0}
910
/>
1011
<List.Item
1112
content="Use the online FTP application to input the multi-byte application!"
1213
contentMedia="11:30:17 PM"
14+
index={1}
1315
/>
1416
<List.Item
1517
content="The GB pixel is down, navigate the virtual interface!"
1618
contentMedia="5:22:40 PM"
19+
index={2}
1720
/>
1821
</List>
1922
)

docs/src/examples/components/List/Content/ListExampleEndMedia.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ const ListExample = () => (
99
content="Program the sensor to the SAS alarm through the haptic SQL card!"
1010
endMedia={ellipsis}
1111
selectable
12+
index={0}
1213
/>
1314
<List.Item
1415
content="Use the online FTP application to input the multi-byte application!"
1516
endMedia={ellipsis}
1617
selectable
18+
index={1}
1719
/>
1820
<List.Item
1921
content="The GB pixel is down, navigate the virtual interface!"
2022
endMedia={ellipsis}
2123
selectable
24+
index={2}
2225
/>
2326
</List>
2427
)

docs/src/examples/components/List/Content/ListExampleHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { List } from '@fluentui/react'
33

44
const ListExample = () => (
55
<List>
6-
<List.Item header="Irving Kuhic" />
7-
<List.Item header="Skyler Parks" />
8-
<List.Item header="Dante Schneider" />
6+
<List.Item header="Irving Kuhic" index={0} />
7+
<List.Item header="Skyler Parks" index={1} />
8+
<List.Item header="Dante Schneider" index={2} />
99
</List>
1010
)
1111

docs/src/examples/components/List/Content/ListExampleHeaderContent.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ const ListExample = () => (
66
<List.Item
77
header="Irving Kuhic"
88
content="Program the sensor to the SAS alarm through the haptic SQL card!"
9+
index={0}
910
/>
1011
<List.Item
1112
header="Skyler Parks"
1213
content="Use the online FTP application to input the multi-byte application!"
14+
index={1}
1315
/>
1416
<List.Item
1517
header="Dante Schneider"
1618
content="The GB pixel is down, navigate the virtual interface!"
19+
index={2}
1720
/>
1821
</List>
1922
)

docs/src/examples/components/List/Content/ListExampleHeaderMedia.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { List } from '@fluentui/react'
33

44
const ListExample = () => (
55
<List>
6-
<List.Item header="Irving Kuhic" headerMedia="7:26:56 AM" />
7-
<List.Item header="Skyler Parks" headerMedia="11:30:17 PM" />
8-
<List.Item header="Dante Schneider" headerMedia="5:22:40 PM" />
6+
<List.Item header="Irving Kuhic" headerMedia="7:26:56 AM" index={0} />
7+
<List.Item header="Skyler Parks" headerMedia="11:30:17 PM" index={1} />
8+
<List.Item header="Dante Schneider" headerMedia="5:22:40 PM" index={2} />
99
</List>
1010
)
1111

docs/src/examples/components/List/Content/ListExampleMedia.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ const ListExampleMedia = () => (
88
header="Irving Kuhic"
99
headerMedia="7:26:56 AM"
1010
content="Program the sensor to the SAS alarm through the haptic SQL card!"
11+
index={0}
1112
/>
1213
<List.Item
1314
media={<Image src="public/images/avatar/small/steve.jpg" avatar />}
1415
header="Skyler Parks"
1516
headerMedia="11:30:17 PM"
1617
content="Use the online FTP application to input the multi-byte application!"
18+
index={1}
1719
/>
1820
<List.Item
1921
media={<Image src="public/images/avatar/small/nom.jpg" avatar />}
2022
header="Dante Schneider"
2123
headerMedia="5:22:40 PM"
2224
content="The GB pixel is down, navigate the virtual interface!"
25+
index={2}
2326
/>
2427
</List>
2528
)

0 commit comments

Comments
 (0)