-
Notifications
You must be signed in to change notification settings - Fork 2.9k
ProgressIndicator: Finish conversion to mergeStyles #4595
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
jordandrako
merged 24 commits into
microsoft:master
from
jordandrako:mergeStyles/ProgressIndicator-part2
Apr 25, 2018
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b25ac16
Scaffold styles file
50fcaf1
Split to base file.
5e94230
Scaffold types file.
a34ca8a
Export base
f8be1b1
Add `animation` to `IRawStyleBase`
9766610
Convert sass to js. Add barHeight prop.
cbe26c0
Use classNames instead of scss in base
c1c266e
Delete sass file
f80d729
let styles default barHeight
c13933b
Fix RTL keyframes
16f9172
changes
0c13499
Update snapshots
72f084f
Merge master, fix conflicts
56c46c3
Fix more conflicts
b7f2a62
Switch to private _classNames set in constructor to prevent tag spam
jordandrako da96361
Remove smoothTransition style prop
jordandrako 5be599f
Merge branch 'master' into mergeStyles/ProgressIndicator-part2
jordandrako ef51588
Remove unused variables
jordandrako 459511b
Update snapshot
jordandrako 5ff099f
simplify
2838ce4
Fix classNames being called with keyframes.
96b0055
Merge branch 'master' into mergeStyles/ProgressIndicator-part2
0180bc8
update snapshot
248425a
Merge master, fix conflicts
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
11 changes: 11 additions & 0 deletions
11
.../changes/@uifabric/merge-styles/mergeStyles-ProgressIndicator-part2_2018-04-18-01-05.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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@uifabric/merge-styles", | ||
| "comment": "Add `animation` to `IRawStyleBase` for use in style sets.", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "@uifabric/merge-styles", | ||
| "email": "[email protected]" | ||
| } |
11 changes: 11 additions & 0 deletions
11
.../changes/office-ui-fabric-react/mergeStyles-ProgressIndicator-part2_2018-04-18-01-05.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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "Complete ProgressIndicator conversion to mergeStyles. Add `barHeight` to enable changing height of progress bar.", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "office-ui-fabric-react", | ||
| "email": "[email protected]" | ||
| } |
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
91 changes: 0 additions & 91 deletions
91
packages/office-ui-fabric-react/src/components/ProgressIndicator/ProgressIndicator.scss
This file was deleted.
Oops, something went wrong.
107 changes: 99 additions & 8 deletions
107
packages/office-ui-fabric-react/src/components/ProgressIndicator/ProgressIndicator.styles.ts
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,40 +1,131 @@ | ||
| import { IProgressIndicatorStyleProps, IProgressIndicatorStyles } from './ProgressIndicator.types'; | ||
| import { | ||
| FontSizes, | ||
| FontWeights, | ||
| HighContrastSelector, | ||
| keyframes, | ||
| noWrap, | ||
| } from '../../Styling'; | ||
| import { getRTL } from '../../Utilities'; | ||
| import { | ||
| IProgressIndicatorStyleProps, | ||
| IProgressIndicatorStyles, | ||
| } from './ProgressIndicator.types'; | ||
|
|
||
| const IndeterminateProgress = keyframes({ | ||
| '0%': { | ||
| left: '-30%', | ||
| }, | ||
| '100%': { | ||
| left: '100%', | ||
| } | ||
| }); | ||
| const IndeterminateProgressRTL = keyframes({ | ||
| '100%': { | ||
| right: '-30%', | ||
| }, | ||
| '0%': { | ||
| right: '100%', | ||
| } | ||
| }); | ||
|
|
||
| export const getStyles = ( | ||
| props: IProgressIndicatorStyleProps | ||
| ): IProgressIndicatorStyles => { | ||
| const { className } = props; | ||
| const isRTL = getRTL(); | ||
| const { | ||
| className, | ||
| indeterminate, | ||
| theme, | ||
| barHeight = 2, | ||
| } = props; | ||
|
|
||
| const { palette, semanticColors } = theme; | ||
|
|
||
| const marginBetweenText = 8; | ||
| const textHeight = 18; | ||
|
|
||
| return ({ | ||
| root: [ | ||
| 'ms-ProgressIndicator', | ||
| {}, | ||
| { | ||
| fontWeight: FontWeights.regular, | ||
| }, | ||
| className | ||
| ], | ||
|
|
||
| itemName: [ | ||
| 'ms-ProgressIndicator-itemName', | ||
| {} | ||
| noWrap, | ||
| { | ||
| color: semanticColors.bodyText, | ||
| fontSize: FontSizes.medium, | ||
| paddingTop: marginBetweenText / 2, | ||
| lineHeight: textHeight + 2, | ||
| } | ||
| ], | ||
|
|
||
| itemDescription: [ | ||
| 'ms-ProgressIndicator-itemDescription', | ||
| {} | ||
| { | ||
| color: semanticColors.bodySubtext, | ||
| fontSize: FontSizes.xSmall, | ||
| lineHeight: textHeight, | ||
| } | ||
| ], | ||
|
|
||
| itemProgress: [ | ||
| 'ms-ProgressIndicator-itemProgress', | ||
| {} | ||
| { | ||
| position: 'relative', | ||
| overflow: 'hidden', | ||
| height: barHeight, | ||
| padding: `${marginBetweenText}px 0`, | ||
| } | ||
| ], | ||
|
|
||
| progressTrack: [ | ||
| 'ms-ProgressIndicator-progressTrack', | ||
| {} | ||
| { | ||
| position: 'absolute', | ||
| width: '100%', | ||
| height: barHeight, | ||
| backgroundColor: palette.neutralLight, | ||
|
|
||
| selectors: { | ||
| [HighContrastSelector]: { | ||
| borderBottom: '1px solid WindowText', | ||
| } | ||
| } | ||
| } | ||
| ], | ||
|
|
||
| progressBar: [ | ||
| 'ms-ProgressIndicator-progressBar', | ||
| {}, | ||
| { | ||
| backgroundColor: palette.themePrimary, | ||
| height: barHeight, | ||
| position: 'absolute', | ||
| transition: 'width .3s ease', | ||
| width: 0, | ||
|
|
||
| selectors: { | ||
| [HighContrastSelector]: { | ||
| backgroundColor: 'WindowText', | ||
| } | ||
| } | ||
| }, | ||
| !indeterminate && { | ||
| transition: 'width .15s linear' | ||
| }, | ||
| indeterminate && [ | ||
| { | ||
| position: 'absolute', | ||
| minWidth: '33%', | ||
| background: `linear-gradient(to right, transparent 0%, ${palette.themePrimary} 50%, transparent 100%)`, | ||
| animation: `${IndeterminateProgress} 3s infinite`, | ||
| }, | ||
| isRTL && { animation: `${IndeterminateProgressRTL} 3s infinite` }, | ||
| ], | ||
| ], | ||
| }); | ||
| }; | ||
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
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.
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.
this may not work in RTL. I'm not sure we will flip "to right" in the linear-gradient... Test in RTL, workaround is (getRTL() ? 'left': 'right')
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.
The gradient is symmetrical so it doesn't currently make a difference between to right or to left, but if it were to change it'd be nice to flip.
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.
It does flip.
