Skip to content
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

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Mar 25, 2019

Pull request checklist

  • Include a change request file using $ npm run change

Description of changes

Fixing some styling-related issues found during example-app-base cleanup:

  • remove CSS global utility classes defined by ExampleCard
  • make FeedbackList not depend on some random class names from the list ghosting example
  • make various places use built-in constants and functions for handling high contrast, rather than rolling their own

Focus areas to test

  • Test all modified components/examples in high contrast mode
Microsoft Reviewers: Open in CodeFlow

import { getTheme, mergeStyleSets, DefaultFontStyles, getFocusStyle } from 'office-ui-fabric-react/lib/Styling';

const theme = getTheme();
export const classNames = mergeStyleSets({
Copy link
Member Author

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.

Copy link
Member

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...

Copy link
Member Author

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]: {
Copy link
Member Author

@ecraig12345 ecraig12345 Mar 26, 2019

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()
Copy link
Member Author

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}>
Copy link
Member Author

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 });
Copy link
Member Author

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:

  1. use a Stack rather than u-marginRight for horizontal spacing
  2. use this button style rather than u-marginBottom

Copy link
Member

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.

Copy link
Member Author

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 } }}
Copy link
Member Author

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),
Copy link
Member Author

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.

@size-auditor
Copy link

size-auditor bot commented Mar 26, 2019

Bundle test Size (minified) Diff from master
PositioningContainer 73.93 kB ExceedsBaseline     20 bytes
Coachmark 93.567 kB ExceedsBaseline     20 bytes
Dropdown 205.487 kB ExceedsBaseline     5 bytes
Breadcrumb 178.62 kB BelowBaseline     -67 bytes
DocumentCard 192.02 kB BelowBaseline     -67 bytes
GroupedList 118.812 kB BelowBaseline     -67 bytes
Link 54.5 kB BelowBaseline     -67 bytes
ShimmeredDetailsList 219.565 kB BelowBaseline     -79 bytes
DetailsList 208.741 kB BelowBaseline     -79 bytes

ExceedsTolerance  Exceeds Tolerance     ExceedsBaseline  Exceeds Baseline     BelowBaseline  Below Baseline     1 kB = 1000 bytes

@ecraig12345 ecraig12345 force-pushed the exampleapp-related-cleanup branch 2 times, most recently from 85d7965 to 5700f13 Compare March 26, 2019 01:31
Copy link
Member

@KevinTCoughlin KevinTCoughlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: -- 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}>
Copy link
Member

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.

Copy link
Member Author

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 });
Copy link
Member

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.

Copy link
Member

@khmakoto khmakoto left a 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! :shipit:

@ecraig12345 ecraig12345 force-pushed the exampleapp-related-cleanup branch from d3da59b to cc6514a Compare March 26, 2019 21:57
@khmakoto
Copy link
Member

khmakoto commented Mar 26, 2019

@ecraig12345 it appears you need to update the API of the merge-styles package.

Edit: This will be done by #8477.

@ecraig12345
Copy link
Member Author

@khmakoto That's actually due to (essentially) a non-obvious merge conflict from Natalie's api-extractor PR. It's being fixed in #8477.

@khmakoto
Copy link
Member

@ecraig12345 just edited my comment to point that out. But thank you for the heads up!

@ecraig12345 ecraig12345 force-pushed the exampleapp-related-cleanup branch from cc6514a to 5d72d73 Compare March 26, 2019 22:25
@ecraig12345 ecraig12345 force-pushed the exampleapp-related-cleanup branch from 5d72d73 to 07ad609 Compare March 27, 2019 00:47
@ecraig12345
Copy link
Member Author

Updated snapshots to fix build failure.

@dzearing dzearing merged commit bbb924c into microsoft:master Mar 27, 2019
@ecraig12345 ecraig12345 deleted the exampleapp-related-cleanup branch March 27, 2019 07:17
@msft-github-bot
Copy link
Contributor

🎉@uifabric/[email protected] has been released which incorporates this pull request.:tada:

Handy links:

@msft-github-bot
Copy link
Contributor

🎉@uifabric/[email protected] has been released which incorporates this pull request.:tada:

Handy links:

@msft-github-bot
Copy link
Contributor

🎉[email protected] has been released which incorporates this pull request.:tada:

Handy links:

@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants