-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Button ex mergestyles #3863
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
Button ex mergestyles #3863
Changes from all commits
dfee4a7
9449d6f
da13094
5c51bba
2b71acd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "Converted ButtonBasicExample to use mergeStyles instead of SCSS.", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "office-ui-fabric-react", | ||
| "email": "[email protected]" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,10 @@ | ||
| import * as React from 'react'; | ||
| import { css, classNamesFunction } from '../../../Utilities'; | ||
| import { | ||
| getStyles, | ||
| IButtonBasicExampleStyleProps, | ||
| IButtonBasicExampleStyles | ||
| } from './Button.Basic.Example.styles'; | ||
| import { | ||
| IButtonProps, | ||
| DefaultButton | ||
|
|
@@ -11,8 +17,11 @@ export class ButtonAnchorExample extends React.Component<IButtonProps> { | |
| public render() { | ||
| let { disabled, checked } = this.props; | ||
|
|
||
| const getClassNames = classNamesFunction<IButtonBasicExampleStyleProps, IButtonBasicExampleStyles>(); | ||
| const classNames = getClassNames(getStyles); | ||
|
|
||
| return ( | ||
| <div className='ms-BasicButtonsExample'> | ||
| <div className={ css(classNames.example) }> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here, we don't need the css() function. |
||
| <DefaultButton | ||
| data-automation-id='test' | ||
| disabled={ disabled } | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { IStyle } from '../../../Styling'; | ||
|
|
||
| export interface IButtonBasicExampleStyleProps { | ||
| /** | ||
| * 404 No Style Props Found | ||
| */ | ||
| } | ||
|
|
||
| export interface IButtonBasicExampleStyles { | ||
| example?: IStyle; | ||
| twoup?: IStyle; | ||
| } | ||
|
|
||
| export function getStyles(props: IButtonBasicExampleStyleProps): IButtonBasicExampleStyles { | ||
| return ({ | ||
| example: [ | ||
| 'ms-BasicButtonsExample', | ||
| { | ||
| selectors: { | ||
| '.ms-Button': { | ||
| margin: '10px 0' | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| twoup: [ | ||
| 'ms-BasicButtonsTwoUp', | ||
| { | ||
| display: 'flex', | ||
| selectors: { | ||
| '& > *': { | ||
| flexGrow: 1 | ||
| }, | ||
| '.ms-Label': { | ||
| marginBottom: '10px' | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,22 @@ | ||
| import * as React from 'react'; | ||
| import { css, classNamesFunction } from '../../../Utilities'; | ||
| import { | ||
| getStyles, | ||
| IButtonBasicExampleStyleProps, | ||
| IButtonBasicExampleStyles | ||
| } from './Button.Basic.Example.styles'; | ||
| import { DefaultButton, IButtonProps } from 'office-ui-fabric-react/lib/Button'; | ||
| import { Label } from 'office-ui-fabric-react/lib/Label'; | ||
|
|
||
| export class ButtonDefaultExample extends React.Component<IButtonProps, {}> { | ||
| public render() { | ||
| let { disabled, checked } = this.props; | ||
|
|
||
| const getClassNames = classNamesFunction<IButtonBasicExampleStyleProps, IButtonBasicExampleStyles>(); | ||
| const classNames = getClassNames(getStyles); | ||
|
|
||
| return ( | ||
| <div className='ms-BasicButtonsTwoUp'> | ||
| <div className={ css(classNames.twoup) }> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as comment above and all other instances. |
||
| <div> | ||
| <Label>Standard</Label> | ||
| <DefaultButton | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,22 @@ | ||
| import * as React from 'react'; | ||
| import { css, classNamesFunction } from '../../../Utilities'; | ||
| import { | ||
| getStyles, | ||
| IButtonBasicExampleStyleProps, | ||
| IButtonBasicExampleStyles | ||
| } from './Button.Basic.Example.styles'; | ||
| import { IconButton, IButtonProps } from 'office-ui-fabric-react/lib/Button'; | ||
| import { Label } from 'office-ui-fabric-react/lib/Label'; | ||
|
|
||
| export class ButtonIconExample extends React.Component<IButtonProps> { | ||
| public render() { | ||
| let { disabled, checked } = this.props; | ||
|
|
||
| const getClassNames = classNamesFunction<IButtonBasicExampleStyleProps, IButtonBasicExampleStyles>(); | ||
| const classNames = getClassNames(getStyles); | ||
|
|
||
| return ( | ||
| <div className='ms-BasicButtonsExample'> | ||
| <div className={ css(classNames.example) }> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| <IconButton | ||
| disabled={ disabled } | ||
| checked={ checked } | ||
|
|
||
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.
We don't need the css function for one class and at all anymore because merge styles takes care of merging a bunch of class names now.