forked from microsoft/fluentui
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(Table): add perf example, make visible existing (microsoft#13373)
* docs(Table): add perf example, make visible existing * reduce iterations
- Loading branch information
1 parent
e5adec2
commit e2ae7d5
Showing
5 changed files
with
57 additions
and
24 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
packages/fluentui/docs/src/examples/components/Table/Performance/TableManyItems.perf.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Table } from '@fluentui/react-northstar'; | ||
import * as _ from 'lodash'; | ||
import * as React from 'react'; | ||
|
||
const header = { | ||
items: ['A', 'B', 'C', 'D'], | ||
}; | ||
const rows = _.times(100, i => ({ | ||
key: i, | ||
items: ['1', '2', '3', '4'], | ||
})); | ||
|
||
const TableManyItemsPerf = () => <Table header={header} rows={rows} />; | ||
|
||
TableManyItemsPerf.iterations = 20; | ||
TableManyItemsPerf.filename = 'TTableManyItems.perf.tsx'; | ||
|
||
export default TableManyItemsPerf; |
13 changes: 13 additions & 0 deletions
13
packages/fluentui/docs/src/examples/components/Table/Performance/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
|
||
import ComponentPerfExample from '../../../../components/ComponentDoc/ComponentPerfExample'; | ||
import ExampleSection from '../../../../components/ComponentDoc/ExampleSection'; | ||
|
||
const Performance = () => ( | ||
<ExampleSection title="Performance"> | ||
<ComponentPerfExample title="Minimal" examplePath="components/Table/Performance/TableMinimal.perf" /> | ||
<ComponentPerfExample title="With many items" examplePath="components/Table/Performance/TableManyItems.perf" /> | ||
</ExampleSection> | ||
); | ||
|
||
export default Performance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 21 additions & 21 deletions
42
packages/fluentui/docs/src/examples/components/Table/Usage/TableExampleStatic.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import * as React from 'react'; | ||
import { Table, tableHeaderCellBehavior } from '@fluentui/react-northstar'; | ||
|
||
const StaticTable = () => ( | ||
const TableExampleStatic = () => ( | ||
<Table aria-label="table"> | ||
<Table.Row header> | ||
<Table.Cell content="id" key="id" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="Name" key="name" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="Picture" key="pic" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="Age" key="age" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="id" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="Name" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="Picture" accessibility={tableHeaderCellBehavior} /> | ||
<Table.Cell content="Age" accessibility={tableHeaderCellBehavior} /> | ||
</Table.Row> | ||
<Table.Row key="1"> | ||
<Table.Cell content="1" key="1-1" /> | ||
<Table.Cell content="Roman van von der Longername" key="1-2" /> | ||
<Table.Cell content="None" key="1-3" /> | ||
<Table.Cell content="30 years" key="1-4" /> | ||
<Table.Row> | ||
<Table.Cell content="1" /> | ||
<Table.Cell content="Roman van von der Longername" /> | ||
<Table.Cell content="None" /> | ||
<Table.Cell content="30 years" /> | ||
</Table.Row> | ||
<Table.Row key="2"> | ||
<Table.Cell content="2" key="1-1" /> | ||
<Table.Cell content="Alex" key="1-2" /> | ||
<Table.Cell content="None" key="1-3" /> | ||
<Table.Cell content="1 year" key="1-4" /> | ||
<Table.Row> | ||
<Table.Cell content="2" /> | ||
<Table.Cell content="Alex" /> | ||
<Table.Cell content="None" /> | ||
<Table.Cell content="1 year" /> | ||
</Table.Row> | ||
<Table.Row key="3"> | ||
<Table.Cell content="3" key="1-1" /> | ||
<Table.Cell content="Ali" key="1-2" /> | ||
<Table.Cell content="None" key="1-3" /> | ||
<Table.Cell content="30000000000000 years" key="1-4" /> | ||
<Table.Row> | ||
<Table.Cell content="3" /> | ||
<Table.Cell content="Ali" /> | ||
<Table.Cell content="None" /> | ||
<Table.Cell content="30000000000000 years" /> | ||
</Table.Row> | ||
</Table> | ||
); | ||
export default StaticTable; | ||
export default TableExampleStatic; |
2 changes: 2 additions & 0 deletions
2
packages/fluentui/docs/src/examples/components/Table/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters