Dialog: Converting to mergeStyles part 2 - style conversion#4160
Dialog: Converting to mergeStyles part 2 - style conversion#4160jordandrako merged 30 commits intomicrosoft:masterfrom
Conversation
oengusmacinog-zz
left a comment
There was a problem hiding this comment.
Few notes. I feel like the bigger the style conversion the harder it will be to catch bits of logic that fell through the cracks when translated from the base.ts file to the styles.ts file - but screener should catch the big stuff there
| return ({ | ||
| content: [ | ||
| 'ms-DialogContent', | ||
| type === DialogType.largeHeader && [ |
There was a problem hiding this comment.
type === DialogType.largeHeader && 'ms-Dialog-lgHeader' is a shorter way to do these ones that are just class no style
There was a problem hiding this comment.
Ah, yeah, I wrote them like that before I copied styles over thinking they'd have styles, thanks.
| import * as stylesImport from './Dialog.scss'; | ||
| const styles: any = stylesImport; | ||
| const getClassNames = classNamesFunction<IDialogStyleProps, IDialogStyles>(); | ||
| // import * as stylesImport from './Dialog.scss'; |
There was a problem hiding this comment.
These can be removed
| } = props; | ||
|
|
||
| const { palette, semanticColors } = theme; | ||
| const dialogDefaultMinWidth = '288px'; |
There was a problem hiding this comment.
I think it might be better to make these a style prop you can pass the default in from base
| } = props; | ||
|
|
||
| const { palette, fonts } = theme; | ||
| const dialogLgHeaderBackgroundColor = palette.themePrimary; |
There was a problem hiding this comment.
dialogLgHeaderBackgroundColor is redundant as its only used once. just use palette.themePrimary where it's used in the styles and nix the extra variable.
|
|
||
| return ({ | ||
| content: [ | ||
| 'ms-DialogContent', |
There was a problem hiding this comment.
I see that this wasn't here before, but I say leave the class 'ms-DialogContent' in. Its an easy semantic way to find the root of this sub/sibling component in the final HTML and that could be useful - at least with any root items that have className passed to them.
| const { getStyles, theme } = this.props; | ||
|
|
||
| this._classNames = getClassNames(getStyles!, { | ||
| theme: theme!, |
There was a problem hiding this comment.
I think if it is a Component class root, it should have a className style prop. With normal usage, you wont really pass anything to it, but DialogFooter is in the index.ts so a dev can grab use it in a custom way and if they do they should be able to pass use the className prop.
oengusmacinog-zz
left a comment
There was a problem hiding this comment.
I think we're good!
|
@dzearing This uses a static defaultProps, is the theme decorator going to cause problems? |
Pull request checklist
$ npm run changeDescription of changes
isMultilineprop to DialogContent (accessed by settingdialogContentProps={{ isMultiline: true }})Focus areas to test
I couldn't find a good way to convert some of the styles that were nested under the class .isMultiline, which seems to be from other components like DetailsList, but not sure if this class was applied in the first place with the way it was written.