This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Pompomon/table prototypes #2379
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e67a5c7
More table prototypes
pompomon 6d71ac4
Adding a11y attributes
pompomon b164192
Adding keyboard navigation, screenreader support
pompomon 1f2c33b
Update changelog
pompomon 79dbf4e
Merge branch 'master' into pompomon/table-prototypes
pompomon 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
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
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,78 @@ | ||
import { | ||
Icon, | ||
Popup, | ||
Table, | ||
gridNestedBehavior, | ||
gridHeaderCellBehavior, | ||
gridRowBehavior, | ||
gridCellBehavior, | ||
} from '@fluentui/react' | ||
import * as React from 'react' | ||
|
||
const columnDescription = 'ID uniquely identifies a uniquely indetifiable item' | ||
|
||
const InteractiveTable = () => { | ||
const [popupOpen, setPopupOpen] = React.useState(false) | ||
const handleFocus = () => setPopupOpen(true) | ||
const handleBlur = () => { | ||
setPopupOpen(false) | ||
} | ||
|
||
return ( | ||
<> | ||
<div id="columnDescription" style={{ display: 'none' }} aria-hidden="true"> | ||
{columnDescription} | ||
</div> | ||
<Table aria-label="table" accessibility={gridNestedBehavior}> | ||
<Table.Row header accessibility={gridRowBehavior}> | ||
<Table.Cell | ||
content={ | ||
<> | ||
<span>Id</span> | ||
<Popup | ||
trigger={<Icon name="info" xSpacing="before" />} | ||
content={columnDescription} | ||
onOpenChange={(e, { open }) => setPopupOpen(open)} | ||
on="hover" | ||
open={popupOpen} | ||
/> | ||
</> | ||
} | ||
key="id" | ||
accessibility={gridHeaderCellBehavior} | ||
aria-describedby="columnDescription" | ||
onFocus={handleFocus} | ||
onBlur={handleBlur} | ||
/> | ||
<Table.Cell content="Name" key="name" accessibility={gridHeaderCellBehavior} /> | ||
<Table.Cell content="Picture" key="pic" accessibility={gridHeaderCellBehavior} /> | ||
<Table.Cell content="Age" key="age" accessibility={gridHeaderCellBehavior} /> | ||
</Table.Row> | ||
<Table.Row key="1" accessibility={gridRowBehavior}> | ||
<Table.Cell content="1" key="1-1" accessibility={gridCellBehavior} /> | ||
<Table.Cell | ||
content="Roman van von der Longername" | ||
key="1-2" | ||
accessibility={gridCellBehavior} | ||
/> | ||
<Table.Cell content="None" key="1-3" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="30 years" key="1-4" accessibility={gridCellBehavior} /> | ||
</Table.Row> | ||
<Table.Row key="2" accessibility={gridRowBehavior}> | ||
<Table.Cell content="2" key="1-1" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="Alex" key="1-2" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="None" key="1-3" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="1 year" key="1-4" accessibility={gridCellBehavior} /> | ||
</Table.Row> | ||
<Table.Row key="3" accessibility={gridRowBehavior}> | ||
<Table.Cell content="3" key="1-1" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="Ali" key="1-2" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="None" key="1-3" accessibility={gridCellBehavior} /> | ||
<Table.Cell content="30000000000000 years" key="1-4" accessibility={gridCellBehavior} /> | ||
</Table.Row> | ||
</Table> | ||
</> | ||
) | ||
} | ||
|
||
export default InteractiveTable |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key
are redundant there