-
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
Styling: integrating glamor based styling, removing fabric-core dependency #1837
Conversation
… This will help identify how we're impacting the bundle size of the button, and will help validate that we're actually able to render a button without fabric-core.
… replacement css utility that works better mixing glamor styling and class name strings together.
…erstandable rules that don't rely on non-contractual css child selectors to do anything. Updated Primary button to not use sass.
…e Icon component!
…c-react into styling-updates # Conflicts: # apps/fabric-website/package.json # common/npm-shrinkwrap.json # common/temp_modules/rush-example-app-base/package.json # common/temp_modules/rush-example-component/package.json # common/temp_modules/rush-fabric-website/package.json # common/temp_modules/rush-office-ui-fabric-react/package.json # common/temp_modules/rush-styling/package.json # common/temp_modules/rush-todo-app/package.json # packages/example-app-base/package.json # packages/office-ui-fabric-react/package.json # packages/office-ui-fabric-react/src/components/pickers/BasePicker.tsx # packages/office-ui-fabric-react/src/utilities/decorators/withContainsFocus.tsx # packages/styling/package.json # tslint.json
…c-react into styling-updates # Conflicts: # apps/fabric-website/package.json # common/npm-shrinkwrap.json # common/temp_modules/rush-example-app-base/package.json # common/temp_modules/rush-fabric-website/package.json # common/temp_modules/rush-office-ui-fabric-react/package.json # common/temp_modules/rush-styling/package.json # packages/example-app-base/package.json
…c-react into styling-updates # Conflicts: # common/npm-shrinkwrap.json # packages/example-app-base/package.json # packages/office-ui-fabric-react/package.json
…c-react into styling-updates # Conflicts: # packages/office-ui-fabric-react/src/components/Persona/examples/Persona.Basic.Example.tsx
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.
I'm always a fan of a change that removes more code than it adds
@@ -148,7 +157,7 @@ export class Breadcrumb extends BaseComponent<IBreadcrumbProps, IBreadcrumbState | |||
} | |||
|
|||
@autobind | |||
private _onOverflowClicked(ev: React.MouseEvent<HTMLElement>) { |
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.
Reason for dropping the type here?
@@ -12,6 +13,32 @@ export interface IButton { | |||
focus: () => void; | |||
} | |||
|
|||
export interface IButtonStyles { |
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.
Some comments to help people realize which is the appropriate style to override for customization?
const DEFAULT_BUTTON_HEIGHT = '32px'; | ||
const DEFAULT_PADDING = '0 4px'; | ||
|
||
export function getStyles( |
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.
No memoize?
@@ -40,15 +40,15 @@ export function getRTL(): boolean { | |||
/** | |||
* Sets the rtl state of the page (by adjusting the dir attribute of the html element.) | |||
*/ | |||
export function setRTL(isRTL: boolean) { | |||
export function setRTL(isRTL: boolean, avoidPersisting = false) { |
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.
:)
pulling this down for a look as well |
getStyles as getDefaultButtonStyles | ||
} from '../DefaultButton/DefaultButton.styles'; | ||
|
||
export function getStyles( |
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 feels like a bunch of boilerplate. theme, custom styles, palette...can we/should we abstract some of that away?
export function getStyles(
theme: ITheme = getTheme(),
customStyles?: IButtonStyles,
): IButtonStyles {
let { palette } = theme;
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.
I'm not really sure. Styles are a function of the theme and of customStyles.
It is possible that we can pull the "global" theme, but it removes the ability to override the theme in a context.
It is possible to not take in customStyles, and to instead mix them in from within the component itself.
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 saying to change any of the functionality. custom themes are obviously important. Just curious if we can wrap it up and abstract what I'm sure will end up in just about every styles file.
If you think this is about as abstract as you want to get right now, no worries. We can always tweak it 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.
Other than a small question about function abstraction, i love this. It could also use an example where we override some styles.
…c-react into styling-updates # Conflicts: # common/temp_modules/rush-example-app-base/package.json # common/temp_modules/rush-office-ui-fabric-react/package.json # common/temp_modules/rush-utilities/package.json # packages/example-app-base/package.json # packages/office-ui-fabric-react/package.json # packages/utilities/package.json
…fficedev/office-ui-fabric-react into styling-updates # Conflicts: # packages/example-app-base/package.json
… like autobind. Updating things accordingly.
…xed mergeStyleSets so that you don’t have to specify “undefined” for non styled things in the base class.
* add semantic colors and convert nonhover toggle colors to use them * fix lint error * address code review feedback and better comment * wip: finishing up toggle, still have disabled thumb color bug to address * update toggle to new way of doing things * code review feedback * cleanup * umm, updates and stuff * cleanup for merge * fix lint errors
…c-react into styling-updates # Conflicts: # packages/example-app-base/package.json # packages/office-ui-fabric-react/package.json
…b of Toggle things.
…c-react into styling-updates # Conflicts: # common/temp_modules/rush-example-app-base/package.json # common/temp_modules/rush-office-ui-fabric-react/package.json # common/temp_modules/rush-styling/package.json # common/temp_modules/rush-utilities/package.json # packages/example-app-base/package.json # packages/office-ui-fabric-react/package.json # packages/office-ui-fabric-react/src/components/Button/BaseButton.scss # packages/office-ui-fabric-react/src/components/Callout/CalloutContent.tsx # packages/office-ui-fabric-react/src/components/Check/Check.scss # packages/office-ui-fabric-react/src/components/DetailsList/DetailsRow.tsx # packages/office-ui-fabric-react/src/components/Fabric/Fabric.tsx # packages/office-ui-fabric-react/src/components/Image/Image.tsx # packages/office-ui-fabric-react/src/components/Layer/examples/Layer.Basic.Example.tsx # packages/office-ui-fabric-react/src/components/Layer/examples/Layer.Hosted.Example.tsx # packages/office-ui-fabric-react/src/components/List/examples/List.Mail.Example.scss # packages/office-ui-fabric-react/src/components/Nav/Nav.tsx # packages/office-ui-fabric-react/src/components/Panel/Panel.tsx # packages/office-ui-fabric-react/src/components/TextField/TextField.tsx # packages/office-ui-fabric-react/src/components/Tooltip/Tooltip.tsx # packages/styling/package.json
…-ui-fabric-react into styling-updates # Conflicts: # packages/example-app-base/package.json # packages/office-ui-fabric-react/package.json # packages/office-ui-fabric-react/src/components/Toggle/Toggle.scss
Addresses #983
Description of changes
Problems we're aiming to solve:
This change does a couple of things:
It creates a dependency on the @uifabric/styling package. This package is still shuffling, but we want to take an early dependency on it and gradually migrate our CSS story.
It completely removes all global css references. There are zero references to ms-font-, ms-u-animation-, ms-icon-*. That means out of the box things will work correctly without needed stylesheets.
Redoes the button styles using glamor. The existing rules have remained intact; we just use glamor to register them. And, if you provide custom rules, we have an opportunity to mix those in, and ensure that we control specificity; the overrides always win.