Skip to content

Conversation

@jordandrako
Copy link
Contributor

@jordandrako jordandrako commented Mar 28, 2018

Pull request checklist

Description of changes

Convert Persona, PersonaCoin, and PersonaPresence to mergeStyles:

  • Convert sass files to mergeStyles.
  • Moved all className and size logic to respective styles files.
  • Create IPersonaSharedProps that is extended by IPersonaProps, IPersonaCoinProps, IPersonaPresenceProps.
    • Props of type IRenderFunction<IPersonaProps> and are used in Persona AND PersonaCoin, such as onRenderCoin, were changed to IRenderFunction<IPersonaSharedProps>.
  • Delete sass files
  • Delete PersonaConsts.ts. It was only applying className logic.
  • Refactor PersonaConsts.ts to serve size and presence states to styles files.
  • Remove unused styles.
    • rootIsDarkText, rootIsSelectable, .rootIsReadonly were in the sass files, but never called from the component, and not accepted in the types.
    • Many classNames replaced with props/conditionals.
  • The presence Icon now doesn't render at size 32 or under (either via PersonaSize enum or coinSize <= 32).

Added functionality:

  • noWrap styles in Styling (Mimics noWrap sass mixin)
  • zIndex namespace in Styling (Mimics $ms-zIndex sass variables) Should not use zIndex, removed from styles.
  • Add High Contrast colors to DefaultPalette (were missing from sass variable conversion)

Other:

  • Update Facepile and ActivityItem to used IPersonaSharedProps
  • Update Facepile test to dive() through decorated Personas.

Focus areas to test

  • Test if IPersonaSharedProps breaks contract
  • Test RTL still work correctly.
  • Test if high contrast mode looks accessible.

};

// Use getStyles from props, or fall back to getStyles from styles file.
const classNames = getClassNames(getStylesProp || getStyles, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dzearing In this case, I am using the same file for PersonaCoinBase and PersonaCoin, so getStyles is directly imported from the PersonaCoin.styles.ts file. Do I need to do this (getStylesProp || getStyles) or does the styled function already take care of getStyles from props?

Copy link
Member

Choose a reason for hiding this comment

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

The styled function already combines getStyles from props! :)

Jordan Janzen added 9 commits April 4, 2018 17:11
- Remove redundant code
- Switch to system fonts only
  - Switch High Contrast colors to agreed new color scheme.
  - Available presence is now Highlight
  - All other presence are WindowText
- Use semanticColors instead of palette colors
- Remove HighContrastBWSelector
- Blocked status match Fabric toolkit
@jordandrako
Copy link
Contributor Author

@phkuo I removed the custom contrast colors and went to just system colors. @betrue-final-final and I conversed offline and decided that the presence colors should be windowtext unless the presence is available, in which case it should be highlight.

I also have some work stashed to help with accessibility and determining presence status (especially in high contrast mode where the colors are now system colors only). Basically, I have the presence component have a title (tooltip) with a descriptor/name of the status on hover. I'm thinking that'll have to be saved for another PR though as it defaults to English. I do have a solution for that as well though by making a new presenceDescriptor API if the user wants/needs the tooltip to be another language.

* background, whether a <color> or an <image>, extends
* underneath its border.
*
* The `text` value is experimental and should not be used
Copy link
Contributor

Choose a reason for hiding this comment

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

should also note it doesn't work in IE

};

export const noWrap: IRawStyle = {
display: 'block',
Copy link
Contributor

Choose a reason for hiding this comment

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

probably would prefer inline-block here, so things don't take up all available width
although i'd prefer just leaving off display altogether and letting the consumer decide between block/inline-block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably a good idea. Thanks for all your thorough reviewing!

Copy link
Contributor

@phkuo phkuo left a comment

Choose a reason for hiding this comment

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

see comments

@jordandrako jordandrako closed this Apr 7, 2018
@jordandrako jordandrako reopened this Apr 7, 2018
@jordandrako jordandrako merged commit 3e51437 into microsoft:master Apr 9, 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.

[Persona] getStyles doesn't work

7 participants