-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix styling issues found in example-app-base cleanup #8467
Fix styling issues found in example-app-base cleanup #8467
Conversation
a17f7af
to
5002809
Compare
import { getTheme, mergeStyleSets, DefaultFontStyles, getFocusStyle } from 'office-ui-fabric-react/lib/Styling'; | ||
|
||
const theme = getTheme(); | ||
export const classNames = mergeStyleSets({ |
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.
So far I'm converting only the former ms-ListGhostingExample-*
classes to css-in-js. The rest of the conversions will come 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.
Hmm, another option would be to replace the divs with Stacks and just use the styles
prop...
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.
Not quite sure offhand what that would look like? I'd prefer to leave this as-is for this PR and possibly come back to it later.
@@ -20,7 +21,7 @@ export const getStyles = (props: ILegendStyleProps): ILegendsStyles => { | |||
}, | |||
rect: { | |||
selectors: { | |||
'@media screen and (-ms-high-contrast: active)': { | |||
[HighContrastSelector]: { |
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.
HighContrastSelector definition for reference (it's identical to the previous string)
} | ||
} | ||
}, | ||
focusClear() |
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.
focusClear definition for reference (it's functionally identical to what the custom method was doing)
Bing | ||
</Link> | ||
</p> | ||
<PivotItem headerText="Pivot 1" keytipProps={keytipMap.Pivot1Keytip} style={pivotItemStyle}> |
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 usage of u-marginBottom
was better handled with a Stack
|
||
export interface IKeytipsButtonExampleState { | ||
btnDisabled: boolean; | ||
} | ||
|
||
const marginBottom = mergeStyles({ marginBottom: 28 }); |
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.
Recommend enabling "Hide whitespace changes" to view this file...the actual changes are:
- use a Stack rather than
u-marginRight
for horizontal spacing - use this button style rather than
u-marginBottom
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 seems to be used for styles
props. Is mergeStyles
needed? I feel like this instead could be:
const marginBottomStyle = { root: { marginBottom: 28 } };
and just passed directly as the styles
prop.
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.
Good point. Fixed that.
}} | ||
/> | ||
<DefaultButton | ||
styles={{ splitButtonContainer: { height: 32 } }} |
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.
And the other actual change (3) is giving the split button a height--for some reason after changing the other styles, it was filling the height of the container rather than just being the same height as its main button.
maxHeight: 500 | ||
}, | ||
itemCell: [ | ||
getFocusStyle(theme, -1), |
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.
getFocusStyle does almost exactly the same thing as the focus-border
mixin, though with slightly different parameter defaults.
85d7965
to
5700f13
Compare
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.
-- Signing-off on List related changes, thank you so much for doing this!!
</Link> | ||
</p> | ||
<PivotItem headerText="Pivot 1" keytipProps={keytipMap.Pivot1Keytip} style={pivotItemStyle}> | ||
<Stack gap={20}> |
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.
Just an FYI mainly, #8247 adds childrenGap
as added as a token
replacing the gap
prop. This means gap={20}
sprinkled through this file could just be a centralized token
object similar to styles
objects.
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.
Good to know, though I'd like to go ahead and check this in rather than waiting on another PR (since I have multiple other changes waiting on this one)
|
||
export interface IKeytipsButtonExampleState { | ||
btnDisabled: boolean; | ||
} | ||
|
||
const marginBottom = mergeStyles({ marginBottom: 28 }); |
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 seems to be used for styles
props. Is mergeStyles
needed? I feel like this instead could be:
const marginBottomStyle = { root: { marginBottom: 28 } };
and just passed directly as the styles
prop.
packages/office-ui-fabric-react/src/components/Keytip/examples/Keytips.Basic.Example.tsx
Show resolved
Hide resolved
packages/office-ui-fabric-react/src/components/Keytip/examples/Keytips.Button.Example.tsx
Outdated
Show resolved
Hide resolved
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.
LGTM, thanks for doing this work!
d3da59b
to
cc6514a
Compare
@ecraig12345 it appears you need to update the API of the Edit: This will be done by #8477. |
@ecraig12345 just edited my comment to point that out. But thank you for the heads up! |
cc6514a
to
5d72d73
Compare
5d72d73
to
07ad609
Compare
Updated snapshots to fix build failure. |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
Pull request checklist
$ npm run change
Description of changes
Fixing some styling-related issues found during example-app-base cleanup:
Focus areas to test
Microsoft Reviewers: Open in CodeFlow