Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Up @@ -20,7 +20,6 @@ import { ButtonSplitExample, ButtonSplitCustomExample } from './examples/Button.
import { ComponentStatus } from '../../demo/ComponentStatus/ComponentStatus';
import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox';
import { Link } from '../../Link';
import './examples/Button.Basic.Example.scss';
import * as exampleStylesImport from '../../common/_exampleStyles.scss';
const exampleStyles: any = exampleStylesImport;

Expand Down
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 {
ActionButton,
IButtonProps
Expand All @@ -12,8 +18,11 @@ export class ButtonActionExample 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) }>
Copy link
Contributor

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.

<ActionButton
data-automation-id='test'
iconProps={ { iconName: 'AddFriend' } }
Expand Down
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
Expand All @@ -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) }>
Copy link
Contributor

Choose a reason for hiding this comment

The 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 }
Expand Down

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,4 +1,10 @@
import * as React from 'react';
import { css, classNamesFunction } from '../../../Utilities';
import {
getStyles,
IButtonBasicExampleStyleProps,
IButtonBasicExampleStyles
} from './Button.Basic.Example.styles';
import {
CompoundButton,
IButtonProps
Expand All @@ -13,8 +19,11 @@ export class ButtonCompoundExample 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 ms-BasicButtonsTwoUp'>
<div className={ css(classNames.example, classNames.twoup) }>
<div>
<Label>Standard</Label>
<CompoundButton
Expand Down
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) }>
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand Down
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) }>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

<IconButton
disabled={ disabled }
checked={ checked }
Expand Down
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 { PrimaryButton, IButtonProps } from 'office-ui-fabric-react/lib/Button';
import { Label } from 'office-ui-fabric-react/lib/Label';

export class ButtonPrimaryExample 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) }>
<PrimaryButton
data-automation-id='test'
disabled={ disabled }
Expand Down
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 { PrimaryButton, IButtonProps } from 'office-ui-fabric-react/lib/Button';
import { Label } from 'office-ui-fabric-react/lib/Label';

export class ButtonScreenReaderExample 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) }>
<PrimaryButton
data-automation-id='test'
disabled={ disabled }
Expand Down
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 { DefaultButton, IconButton, IButtonProps } from 'office-ui-fabric-react/lib/Button';
import { Label } from 'office-ui-fabric-react/lib/Label';
import { getCustomSplitButtonStyles } from './Button.Split.Example.styles';
Expand All @@ -12,8 +18,11 @@ export class ButtonSplitExample 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) }>
<div>
<Label>Standard</Label>
<DefaultButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';

import { css, classNamesFunction } from '../../../Utilities';
import {
getStyles,
IButtonBasicExampleStyleProps,
IButtonBasicExampleStyles
} from './Button.Basic.Example.styles';
import {
autobind
} from 'office-ui-fabric-react/lib/Utilities';
Expand Down Expand Up @@ -65,8 +70,11 @@ export class ButtonSwapExample extends React.Component<IButtonProps, IButtonSwap
</DefaultButton>
);

const getClassNames = classNamesFunction<IButtonBasicExampleStyleProps, IButtonBasicExampleStyles>();
const classNames = getClassNames(getStyles);

return (
<div className='ms-BasicButtonsExample'>
<div className={ css(classNames.example) }>
{ button }
</div>
);
Expand Down