-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Tree documentation and stories #27270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 20 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
4166f52
tree stories
8ce1845
more
d15b7d8
persona
65f57c4
simplifiy
9267728
description
fbf57b7
persona and changes
2adef64
update desc
71892ed
folder structure
7f898e1
Do's
ec2aeb8
Merge branch 'master' into tree-stories-desc
petdud 346ea26
treeitem
584615f
Merge branch 'tree-stories-desc' of https://github.com/petr-duda/flue…
5b0447f
change
15d5275
Update change/@fluentui-react-tree-7b614498-e79f-460b-a3a4-22ba4d9a2b…
petdud 17c47c6
Update packages/react-components/react-tree/stories/Tree/Virtualizati…
petdud c819c6f
Update packages/react-components/react-tree/stories/Tree/Virtualizati…
petdud 0f7c9bc
Update packages/react-components/react-tree/stories/Tree/TreeBestPrac…
petdud 9672350
Update packages/react-components/react-tree/stories/Tree/TreeDescript…
petdud 38ea28a
fix treeitem description
c64f084
Merge branch 'master' into tree-stories-desc
petdud a1b41ac
Merge branch 'master' into tree-stories-desc
petdud d2e47b1
Merge branch 'master' into tree-stories-desc
petdud eab54f6
tree stories
0a73e31
more
7555038
persona
782f0f2
simplifiy
86231ba
description
05d82eb
persona and changes
a592f48
update desc
1c58dea
folder structure
ee06485
Do's
f7e6c11
treeitem
98d3616
change
637bff2
Update change/@fluentui-react-tree-7b614498-e79f-460b-a3a4-22ba4d9a2b…
petdud 762da4b
Update packages/react-components/react-tree/stories/Tree/Virtualizati…
petdud e3427ee
Update packages/react-components/react-tree/stories/Tree/Virtualizati…
petdud bcd2260
Update packages/react-components/react-tree/stories/Tree/TreeBestPrac…
petdud cf251c1
Update packages/react-components/react-tree/stories/Tree/TreeDescript…
petdud 1e0c25f
fix treeitem description
b83d89e
Merge branch 'tree-stories-desc' of https://github.com/petr-duda/flue…
a3da949
Merge branch 'master' into tree-stories-desc
petdud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-tree-7b614498-e79f-460b-a3a4-22ba4d9a2bea.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "tree stories and doc update", | ||
| "packageName": "@fluentui/react-tree", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch" | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
packages/react-components/react-tree/stories/Layouts/TreeItemLayout.md
This file contains hidden or 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 @@ | ||
| You can combine multiple props to customize the appearance and behavior of a `Tree` component. It includes the use of `icons`, `badges`, `actions`, and layouts, which can be composed together to create a more complex and flexible user interface. |
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
packages/react-components/react-tree/stories/Layouts/TreeItemLayoutAside.md
This file contains hidden or 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 @@ | ||
| The `Tree` component allows for an `aside` prop to be added to individual `TreeItemLayout` or `TreeItemPersonaLayout` layout components. This creates an area on the right side of the `TreeItem` where additional information can be displayed, such as a badge with notification count or an icon indicating importance. When actions are specified using the `actions` prop, they will overlay the `aside` area on hover. |
This file contains hidden or 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
36 changes: 36 additions & 0 deletions
36
packages/react-components/react-tree/stories/Layouts/TreeItemLayoutDefault.stories.tsx
This file contains hidden or 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,36 @@ | ||
| import * as React from 'react'; | ||
| import { Tree, TreeItem, TreeItemLayout } from '@fluentui/react-tree'; | ||
|
|
||
| export const DefaultTreeItemLayout = () => { | ||
| return ( | ||
| <Tree aria-label="Tree"> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 1, item 1</TreeItemLayout> | ||
| <Tree> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 2, item 1</TreeItemLayout> | ||
| </TreeItem> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 2, item 2</TreeItemLayout> | ||
| </TreeItem> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 2, item 3</TreeItemLayout> | ||
| </TreeItem> | ||
| </Tree> | ||
| </TreeItem> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 1, item 2</TreeItemLayout> | ||
| <Tree> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 2, item 1</TreeItemLayout> | ||
| <Tree> | ||
| <TreeItem> | ||
| <TreeItemLayout>level 3, item 1</TreeItemLayout> | ||
| </TreeItem> | ||
| </Tree> | ||
| </TreeItem> | ||
| </Tree> | ||
| </TreeItem> | ||
| </Tree> | ||
| ); | ||
| }; |
1 change: 1 addition & 0 deletions
1
packages/react-components/react-tree/stories/Layouts/TreeItemPersonaLayout.md
This file contains hidden or 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 @@ | ||
| With `TreeItemPersonaLayout`, `TreeItem`, and `Tree`, you can create a highly customizable and flexible UI by leveraging various props like `media`, `icons`, `badges`, and `actions`. Here are some examples of how you can use these components together to achieve different layouts and appearances. |
This file contains hidden or 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
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
...react-components/react-tree/stories/Layouts/TreeItemPersonaLayoutDescription.md
This file contains hidden or 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 @@ | ||
| `TreeItemPersonaLayout` is a layout component used to display a `TreeItem` with a media (such as an avatar) and a description. Its purpose is to provide a more visually appealing representation of a `TreeItem`, often used to display a list of people or related topics. |
3 changes: 3 additions & 0 deletions
3
packages/react-components/react-tree/stories/Layouts/TreeItemPersonaLayoutMedia.md
This file contains hidden or 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,3 @@ | ||
| The `TreeItemPersonaLayout` component allows each `TreeItem` to be displayed with a persona layout, which supports a `media` prop such as an `Avatar`. | ||
|
|
||
| The `Avatar` component can be customized with different sizes and shapes to suit the design needs. |
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
.../react-components/react-tree/stories/Layouts/TreeItemPersonaLayoutReadUnread.md
This file contains hidden or 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 @@ | ||
| Layout components can be customized with different styles to make it more visually appealing. In the example below, the component is used to display chat messages. We differentiate between read and unread messages by applying customized styles using the `makeStyles` hook. |
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
...t-components/react-tree/stories/Layouts/TreeItemPersonaLayoutWithDescription.md
This file contains hidden or 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 @@ | ||
| You can add a `description` prop to the `TreeItemPersonaLayout` that can be used to display secondary text content beneath the primary text content. This is useful for providing additional information or context about the primary content. |
This file contains hidden or 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
5 changes: 5 additions & 0 deletions
5
packages/react-components/react-tree/stories/Layouts/description.md
This file contains hidden or 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,5 @@ | ||
| The `TreeItem` component allows for flexible display of items in a tree structure by supporting two types of layouts: `TreeItemLayout` and `TreeItemPersonaLayout`. | ||
|
|
||
| The `TreeItemLayout` component is designed to provide a consistent and functional structure for displaying a tree item. It defines the content and layout of the item in a simple and straightforward manner. This layout is ideal for displaying information about items that do not require additional visual elements, such as files or folders in a file system. | ||
|
|
||
| On the other hand, the `TreeItemPersonaLayout` component provides a more visually appealing representation of a tree item by including a media element, typically an avatar, alongside a description. This layout is perfect for displaying lists of people or topics, where the media element can represent an individual or a topic icon. As with `TreeItemLayout`, `TreeItemPersonaLayout` should only be used as a direct child of TreeItem. |
23 changes: 23 additions & 0 deletions
23
packages/react-components/react-tree/stories/Layouts/index.stories.tsx
This file contains hidden or 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,23 @@ | ||
| import { TreeItemLayout, TreeItemPersonaLayout } from '@fluentui/react-tree'; | ||
| import descriptionMd from './description.md'; | ||
|
|
||
| export { DefaultTreeItemLayout } from './TreeItemLayoutDefault.stories'; | ||
| export { DefaultTreeItemPersonaLayout } from './TreeItemPersonaLayoutDefault.stories'; | ||
| export { Aside } from './TreeItemLayoutAside.stories'; | ||
| export { Media } from './TreeItemPersonaLayoutMedia.stories'; | ||
| export { WithDescription } from './TreeItemPersonaLayoutWithDescription.stories'; | ||
| export { ReadUnread } from './TreeItemPersonaLayoutReadUnread.stories'; | ||
| export { Layout } from './TreeItemLayout.stories'; | ||
| export { TreePersonaLayout } from './TreeItemPersonaLayout.stories'; | ||
|
|
||
| export default { | ||
| title: 'Preview Components/Tree/Layouts', | ||
| component: [TreeItemPersonaLayout, TreeItemLayout], | ||
| parameters: { | ||
| docs: { | ||
| description: { | ||
| component: [descriptionMd].join('\n'), | ||
| }, | ||
| }, | ||
| }, | ||
| }; |
1 change: 1 addition & 0 deletions
1
packages/react-components/react-tree/stories/Tree/TreeAppearance.md
This file contains hidden or 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 @@ | ||
| The `Tree` component supports different appearances for TreeItems. The default apperance value is `subtle`. The `subtle-alpha` appearance minimizes emphasis on hovered or focused states, while the `transparent` appearance removes the background color. |
This file contains hidden or 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
13 changes: 11 additions & 2 deletions
13
packages/react-components/react-tree/stories/Tree/TreeBestPractices.md
This file contains hidden or 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,5 +1,14 @@ | ||
| ## Best practices | ||
| <details> | ||
| <summary> | ||
| Best Practices | ||
| </summary> | ||
|
|
||
| ### Do | ||
|
|
||
| ### Don't | ||
| - Use the `Tree` component to create a tree structure with `TreeItem` components as children. | ||
| - Organize nodes in a clear hierarchy, with parent nodes at higher levels and child nodes at lower levels. | ||
| - Use custom styles if the tree needs to support more than 10 levels of nesting. | ||
| - Provide an alternative way to represent the tree structure by flattening it into a list of items. | ||
| - Use the `aria-label` attribute on the root of the Tree component to provide an accessible name for the tree. | ||
|
|
||
| </details> |
3 changes: 3 additions & 0 deletions
3
packages/react-components/react-tree/stories/Tree/TreeControllingOpenAndClose.md
This file contains hidden or 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,3 @@ | ||
| The `Tree` component provides a way to control the open/closed state of individual `TreeItem` components using the `openItems` and `onOpenChange` props. | ||
|
|
||
| The `openItems` prop takes an array of `TreeItem` IDs that are currently open, while the `onOpenChange` callback function is called whenever a `TreeItem` is opened or closed. You can then use the callback to update the `openItems` array and keep track of which `TreeItems` are open or closed. |
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1
packages/react-components/react-tree/stories/Tree/TreeDefaultOpenTrees.md
This file contains hidden or 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 @@ | ||
| The `Tree` component allows you to set the default open/closed state using the `defaultOpenItems` prop for expandable `TreeItem` components. This prop takes an array of `TreeItem` IDs that should be open by default. When the `Tree` is first rendered, the `TreeItem` components listed in `defaultOpenItems` will be open by default, while all other expandable `TreeItem` components will be closed. |
This file contains hidden or 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
2 changes: 2 additions & 0 deletions
2
packages/react-components/react-tree/stories/Tree/TreeDescription.md
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
| The `size` prop is used to change the size of the `Tree` and its items. It accepts two values: `medium` (default) and `small`. You can set this prop on the `Tree` component to change the size of all items within the tree. |
This file contains hidden or 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
3 changes: 3 additions & 0 deletions
3
packages/react-components/react-tree/stories/Tree/Virtualization.md
This file contains hidden or 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,3 @@ | ||
| A `Tree` can be virtualized to optimize the rendering of a large tree structure. This technique involves creating a virtual version of the tree that only loads the visible nodes at any given time. By doing so, it reduces the number of DOM nodes that need to be rendered, which in turn improves time to interaction of large trees. | ||
|
|
||
| To achieve this, one can create a `flattened` version of the tree structure that can be easily consumed by a virtualization library. This library renders only the items that are currently visible on the screen, which improves TTI metrics. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.