Skip to content

Convert Overlay to mergeStyles#3978

Merged
jordandrako merged 18 commits intomicrosoft:masterfrom
jordandrako:mergeStyles/Overlay
Feb 17, 2018
Merged

Convert Overlay to mergeStyles#3978
jordandrako merged 18 commits intomicrosoft:masterfrom
jordandrako:mergeStyles/Overlay

Conversation

@jordandrako
Copy link
Copy Markdown
Contributor

Pull request checklist

  • Include a change request file using $ npm run change

Description of changes

Converts Overlay and it's examples to mergeStyles. Add theme support.
Add whiteTranslucent40 to theme palette.

Focus areas to test

Test if Overlay and any component that uses it as a subcomponent still function properly.

className
],

// Insert className styles
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.

I think this comment was meant for above 49?

}

export interface IOverlayProps extends React.HTMLAttributes<HTMLElement> {
export interface IOverlayProps extends React.Props<OverlayBase> {
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.

Was there a reason for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was experimenting with typings and forgot to change it back, though, this is the pattern other components use. Thanks for catching this.

IOverlayStyles,
} from './Overlay.types';

import { classNamesFunction } from '../../Utilities';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this import can just move up with the others


selectors: {
[HighContrastSelector]: {
border: '1px solid WindowText',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is WindowText a valid choice here? This may be High Contrast Mode specific, but I just imagine it would be better to use a theme color.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup, it's HighContrast specific.

@@ -1,41 +1,13 @@
import * as React from 'react';
import { styled } from '@uifabric/utilities';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we wanted to do import { styled } from '../../Utilities';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch.

}
},

isNone && {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Process question: From what I can tell this was never actually applied before (just an unused SCSS class), and you went ahead and applied that as an optional prop. Do we want to do this, or assume abandoned functionality was abandoned for a reason. Like in this case does it serve a purpose or is it just a superfluous prop taking up bit space.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. @battletoilet

/**
* Style for the root element.
*/
root?: IStyle;
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.

don't we want all classNames to be required? @dzearing @mikewheaton

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.

that way we can insure, inside getStyles, that we're making the entire thing. and then other consumers customizing it can just say Partial if they're merging with the existing one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In this case, having them required prevents customizing the styles via the customStyles prop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could you point me to an example of Partial styles?

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.

I would like for us to have a way to insure any and all classNames defined in IFooStyles gets defined in the default implementation, while allowing other implementations to use a Partial<> to only have to override a subset.
I don't have any examples (we barely do any style customization right now as it is). Where is the customStyles prop used, in getStyles? Does this work?
getStyles: IStylesFunction<IFooProps, Partial>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Excuse me, the Component I was thinking of that uses customStyles is Checkbox, which I have another PR out for. I'll keep Partial in mind.

const {
className,
theme,
isNone,
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.

Could this be renamed for clarity? Maybe reverse it and call it isVisible?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, it's not used at the moment so that should be remedied.

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.

Can we remove it entirely then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had the same question but forgot to follow up on it. @battletoilet - thoughts?

visibility: 'hidden',
},

isDarkThemed && [
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.

Could we rename this to isDark? That would match the CSS class below, and remove any potential confusion around this prop and theming.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll have to deprecate it but sure.

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.

Even if we don't change the component's prop, this style prop could be changed for now right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, yeah.

Copy link
Copy Markdown
Contributor

@mikewheaton mikewheaton left a comment

Choose a reason for hiding this comment

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

Approved with minor comments.

@jordandrako jordandrako merged commit 1f1db9d into microsoft:master Feb 17, 2018
@jordandrako jordandrako deleted the mergeStyles/Overlay branch February 17, 2018 00:11
Markionium added a commit to Markionium/office-ui-fabric-react that referenced this pull request Feb 18, 2018
* master: (71 commits)
  Applying package updates.
  Delete initials_2018-02-07-13-49.json
  Delete initials_2018-02-07-13-49.json
  Delete jolore-addingWorkWeekDateRange_2018-01-24-01-39.json
  Delete initials_2018-02-07-13-49.json
  Delete jolore-addingWorkWeekDateRange_2018-01-24-01-39.json
  Delete initials_2018-02-07-13-49.json
  Update .npmrc
  Cleaning Up Console Log in CommandBar Test (microsoft#4011)
  Convert Overlay to mergeStyles (microsoft#3978)
  ScrollablePane SCSS to MergeStyles Part 1: File Structure (microsoft#4008)
  [ContextualMenu] Fixes useTargetWidth property (microsoft#3943)
  DetailsList: Consider groups when setting aria-rowcount
  List: Add a _notifyPageChanges function  (microsoft#3990)
  Applying package updates.
  Migrating Coachmark to main Package, Added a beak component and updated experiment PositioningContainer. (microsoft#3919)
  Update package.json
  Added enum for triggering menu with arrow keys and bool to allow it or not (microsoft#3950)
  BaseExtendedPicker: Hook up onPaste (microsoft#3885)
  FocusUtil: fix getPreviousElement to include previous sibling elements correctly (microsoft#3928)
  ...
@jordandrako jordandrako restored the mergeStyles/Overlay branch February 21, 2018 22:35
@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.

6 participants