Skip to content

CalloutContent: Convert CalloutContent to JS Styling#3745

Merged
dzearing merged 44 commits into
microsoft:masterfrom
montselozanod:malozano/CalloutStyling
Jan 25, 2018
Merged

CalloutContent: Convert CalloutContent to JS Styling#3745
dzearing merged 44 commits into
microsoft:masterfrom
montselozanod:malozano/CalloutStyling

Conversation

@montselozanod

Copy link
Copy Markdown
Member

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change

Description of changes

Created CalloutContentBase and separated the styling of the CalloutContent to a getStyles function. This will enable customization of the Callout component.

Change also adds the mixin focus-clear to the styling package, so it is reusable for other components.

Focus areas to test

Screen shots of components should look the same.

@joschect joschect requested a review from dzearing January 19, 2018 02:19
maskOrigin?: ICSSRule | string;
maxFontSize?: ICSSRule | string;
maxHeight?: ICSSRule | string;
maxFontSize?: ICSSRule | ICSSPixelUnitRule;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I changed maxFontSize and maxHeight because components have these props set as numbers, so with ICSSPixelUnitRule it can be either a number and string (the same we do for other length css rules). Just wanted to verify it is all right with you guys and there are no concerns?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be fine.

*/
theme: ITheme;

calloutWidth?: number;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will add comments to all the props

/**
* Generates style to clear browser specific focus styles.
*/
export function focusClear(): IRawStyle {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

focusClear is a mixin used by several components so I created a function in the styling package. I just realized that there is one in the experiments package. What are your thoughts? Should I remove the one from the experimental package if we keep this hear?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dzearing do you have thoughts on this?

* Deprecated at v0.59.1, to be removed at >= v1.0.0. Pass in a beakWidth to dictate size.
* @deprecated
*/
beakStyle?: string;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This has been deprecated in the props, but is still being used in the getBeakStyle func. Is it safe to remove from props, styleprops and func or are there still concerns of this being breaking change? Comment makes me think that it is okay to remove now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's probably not, we should remove it in 6.0, although I really hope no one is using it right now...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good q for @joschect

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@joschect is it good to remove this now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@joschect sounds good! I'll leave it in.

exports[`Callout renders Callout correctly 1`] = `
<div
className="ms-Callout-container"
className={undefined}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

some of the global class names are being dropped off here. Is this being tested correctly? You shouldn't see a big change in the snapshot tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What do you mean by tested correctly, unit tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thing this happened because I used CalloutContentBase in the tests instead of CalloutContent. After changing that, I get the classes back.

@dzearing dzearing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall this is great, nice job! Can you just check the snapshot diff, and dig into why the classes aren't there any more? Even if they aren't used, they should probably be included int the .styles content. (e.g. ms-Callout)

filter: 'opacity(0)',
},
positions && {
top: positions.elementPosition.top,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ITT You can just do positions && positions.elementPosition, since it's already got bottom, left, right and such. You might need to expand it with ... or something though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

positions && { ...positions.elementPosition }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let me make this change

maskOrigin?: ICSSRule | string;
maxFontSize?: ICSSRule | string;
maxHeight?: ICSSRule | string;
maxFontSize?: ICSSRule | ICSSPixelUnitRule;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be fine.

* Deprecated at v0.59.1, to be removed at >= v1.0.0. Pass in a beakWidth to dictate size.
* @deprecated
*/
beakStyle?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's probably not, we should remove it in 6.0, although I really hope no one is using it right now...

/**
* Generates style to clear browser specific focus styles.
*/
export function focusClear(): IRawStyle {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dzearing do you have thoughts on this?

@joschect

Copy link
Copy Markdown
Contributor

I think this looks pretty good. Any last comments @phkuo or @dzearing ?

@dzearing dzearing merged commit a2864f8 into microsoft:master Jan 25, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 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.

4 participants