-
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.
ProgressIndicator: Finish conversion to mergeStyles (#4595)
* Scaffold styles file * Split to base file. * Scaffold types file. * Export base * Add `animation` to `IRawStyleBase` * Convert sass to js. Add barHeight prop. * Use classNames instead of scss in base * Delete sass file * let styles default barHeight * Fix RTL keyframes * changes * Update snapshots * Fix more conflicts * Switch to private _classNames set in constructor to prevent tag spam * Remove smoothTransition style prop * Remove unused variables * Update snapshot * simplify * Fix classNames being called with keyframes. * update snapshot
- Loading branch information
1 parent
5e99f2d
commit b9f6e84
Showing
8 changed files
with
305 additions
and
133 deletions.
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 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": "v-jojanz@microsoft.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
.../changes/office-ui-fabric-react/mergeStyles-ProgressIndicator-part2_2018-04-18-01-05.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,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": "v-jojanz@microsoft.com" | ||
} |
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
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 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 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.