-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving Breadcrumb to react-next, in preparation for converting to a f…
…unction component (#15054) * Moving breadcrumb to react-next * Reverting an accidental file. * Change files * Updating the api * Updating example snapshots.
- Loading branch information
Showing
24 changed files
with
10,322 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import { Breadcrumb } from 'office-ui-fabric-react'; | ||
|
||
const items = [{ text: 'test', key: 'f1' }]; | ||
const Scenario = () => <Breadcrumb items={items} />; | ||
|
||
export default Scenario; |
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,7 @@ | ||
import * as React from 'react'; | ||
import { Breadcrumb } from '@fluentui/react-next'; | ||
|
||
const items = [{ text: 'test', key: 'f1' }]; | ||
const Scenario = () => <Breadcrumb items={items} />; | ||
|
||
export default Scenario; |
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,112 @@ | ||
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */ | ||
import * as React from 'react'; | ||
import Screener from 'screener-storybook/src/screener'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { FabricDecoratorTall } from '../utilities'; | ||
import { Breadcrumb } from '@fluentui/react-next'; | ||
|
||
const noOp = () => undefined; | ||
|
||
storiesOf('Breadcrumb', module) | ||
.addDecorator(FabricDecoratorTall) | ||
.addDecorator(story => ( | ||
<Screener | ||
steps={new Screener.Steps() | ||
.snapshot('default', { cropTo: '.testWrapper' }) | ||
.executeScript( | ||
"document.getElementsByClassName('testWrapper')[0].classList.add('ms-Fabric--isFocusVisible')", | ||
) | ||
.executeScript("document.getElementsByClassName('ms-Breadcrumb-overflowButton')[0].focus()") | ||
.snapshot('overflowButtonFocus', { cropTo: '.testWrapper' }) | ||
.executeScript("document.getElementsByClassName('ms-Breadcrumb-itemLink')[0].focus()") | ||
.snapshot('itemLinkFocus', { cropTo: '.testWrapper' }) | ||
.executeScript( | ||
"document.getElementsByClassName('testWrapper')[0].classList.remove('ms-Fabric--isFocusVisible')", | ||
) | ||
.hover('.ms-Breadcrumb-overflowButton') | ||
.snapshot('hover', { cropTo: '.testWrapper' }) | ||
.click('.ms-Breadcrumb-overflowButton') // opening the dropdown | ||
.hover('.ms-Breadcrumb-overflowButton') // moving the mouse a bit to let dropdown open. | ||
.snapshot('click', { cropTo: '.testWrapper' }) | ||
.click('.ms-Breadcrumb-overflowButton') // closing the dropdown | ||
.hover('.ms-Breadcrumb-list li:nth-child(2)') | ||
.snapshot('longTitleHover', { cropTo: '.testWrapper' }) | ||
.hover('.ms-Breadcrumb-list li:nth-child(3)') | ||
.snapshot('shortTitleHover', { cropTo: '.testWrapper' }) | ||
.end()} | ||
> | ||
{story()} | ||
</Screener> | ||
)) | ||
.addStory( | ||
'Root', | ||
() => ( | ||
<Breadcrumb | ||
items={[ | ||
{ text: 'Files', key: 'Files', href: '#/examples/breadcrumb' }, | ||
{ text: 'This is link 1', key: 'l1', href: '#/examples/breadcrumb' }, | ||
{ text: 'This is link 2', key: 'l2', href: '#/examples/breadcrumb' }, | ||
{ text: 'This is link 3 with a long name', key: 'l3', href: '#/examples/breadcrumb' }, | ||
{ text: 'This is link 4', key: 'l4', href: '#/examples/breadcrumb' }, | ||
{ text: 'This is link 5', key: 'l5', href: '#/examples/breadcrumb', isCurrentItem: true }, | ||
]} | ||
maxDisplayedItems={3} | ||
/> | ||
), | ||
{ rtl: true }, | ||
) | ||
.addStory( | ||
'Button', | ||
() => ( | ||
<Breadcrumb | ||
items={[ | ||
{ text: 'Files', key: 'Files', onClick: noOp }, | ||
{ text: 'This is folder 1', key: 'l1', onClick: noOp }, | ||
{ text: 'This is folder 2', key: 'l2', onClick: noOp }, | ||
{ text: 'This is folder 3', key: 'l3', onClick: noOp }, | ||
{ text: 'This is folder 4', key: 'l4', onClick: noOp }, | ||
{ text: 'This is folder 5', key: 'l5', onClick: noOp, isCurrentItem: true }, | ||
]} | ||
maxDisplayedItems={3} | ||
/> | ||
), | ||
{ rtl: true }, | ||
); | ||
|
||
// Stories for hovering over actionable and non-actionable items | ||
storiesOf('Breadcrumb', module) | ||
.addDecorator(FabricDecoratorTall) | ||
.addDecorator(story => ( | ||
<Screener | ||
steps={new Screener.Steps() | ||
.hover('.ms-Breadcrumb-list li:nth-child(2)') | ||
.snapshot('actionable hover', { cropTo: '.testWrapper' }) | ||
.hover('.ms-Breadcrumb-list li:nth-child(3)') | ||
.snapshot('non-actionable hover', { cropTo: '.testWrapper' }) | ||
.hover('.ms-Breadcrumb-overflowButton') | ||
.click('.ms-Breadcrumb-overflowButton') // opening the dropdown | ||
.hover('.ms-Breadcrumb-overflowButton') // moving the mouse a bit to let dropdown open. | ||
.hover('.ms-ContextualMenu-list li:nth-child(2)') | ||
.snapshot('actionable overflow hover', { cropTo: '.testWrapper' }) | ||
.hover('.ms-ContextualMenu-list li:nth-child(3)') | ||
.snapshot('non-actionable overflow hover', { cropTo: '.testWrapper' }) | ||
.end()} | ||
> | ||
{story()} | ||
</Screener> | ||
)) | ||
.addStory('Hovering items', () => ( | ||
<Breadcrumb | ||
items={[ | ||
// overflow | ||
{ text: 'Files', key: 'Files' }, | ||
{ text: 'Folder 1', key: 'l1', onClick: noOp }, | ||
{ text: 'Folder 2 no action', key: 'l2' }, | ||
// displayed | ||
{ text: 'Folder 3', key: 'l3', onClick: noOp }, | ||
{ text: 'Folder 4 no action', key: 'l4' }, | ||
{ text: 'Folder 5', key: 'l5', onClick: noOp, isCurrentItem: true }, | ||
]} | ||
maxDisplayedItems={3} | ||
/> | ||
)); |
8 changes: 8 additions & 0 deletions
8
change/@fluentui-react-next-2020-09-14-17-40-31-feat-moving-breadcrumb.json
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,8 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Moving Breadcrumb to react-next for future function component conversion.", | ||
"packageName": "@fluentui/react-next", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch", | ||
"date": "2020-09-15T00:40:31.083Z" | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'office-ui-fabric-react/lib/Breadcrumb'; | ||
export * from './components/Breadcrumb/index'; |
Oops, something went wrong.