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": "GroupSpacer: Reduce render calls by refactoring styled HOC to React.SFC",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8369,11 +8369,13 @@ interface IGroupShowAllStyles {
interface IGroupSpacerProps {
count: number;
indentWidth?: number;
// @deprecated
styles?: IStyleFunctionOrObject<IGroupSpacerStyleProps, IGroupSpacerStyles>;
// @deprecated
theme?: ITheme;
}

// @public (undocumented)
// @public @deprecated (undocumented)
interface IGroupSpacerStyles {
// (undocumented)
root: IStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5206,17 +5206,13 @@ exports[`DetailsList renders List with hidden checkboxes correctly 1`] = `
}
>
<span
className=
ms-GroupSpacer
{
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
font-size: 14px;
font-weight: 400;
width: 32px;
}
className="ms-GroupSpacer"
style={
Object {
"display": "inline-block",
"width": 32,
}
}
/>
<div
className=
Expand Down Expand Up @@ -5400,17 +5396,13 @@ exports[`DetailsList renders List with hidden checkboxes correctly 1`] = `
}
>
<span
className=
ms-GroupSpacer
{
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
font-size: 14px;
font-weight: 400;
width: 32px;
}
className="ms-GroupSpacer"
style={
Object {
"display": "inline-block",
"width": 32,
}
}
/>
<div
className=
Expand Down Expand Up @@ -5836,17 +5828,13 @@ exports[`DetailsList renders List with hidden checkboxes correctly 1`] = `
}
>
<span
className=
ms-GroupSpacer
{
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
font-size: 14px;
font-weight: 400;
width: 32px;
}
className="ms-GroupSpacer"
style={
Object {
"display": "inline-block",
"width": 32,
}
}
/>
<div
className=
Expand Down Expand Up @@ -6030,17 +6018,13 @@ exports[`DetailsList renders List with hidden checkboxes correctly 1`] = `
}
>
<span
className=
ms-GroupSpacer
{
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
font-size: 14px;
font-weight: 400;
width: 32px;
}
className="ms-GroupSpacer"
style={
Object {
"display": "inline-block",
"width": 32,
}
}
/>
<div
className=
Expand Down Expand Up @@ -6224,17 +6208,13 @@ exports[`DetailsList renders List with hidden checkboxes correctly 1`] = `
}
>
<span
className=
ms-GroupSpacer
{
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
font-size: 14px;
font-weight: 400;
width: 32px;
}
className="ms-GroupSpacer"
style={
Object {
"display": "inline-block",
"width": 32,
}
}
/>
<div
className=
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
import * as React from 'react';
import { styled, classNamesFunction } from '../../Utilities';
import { IGroupSpacerProps, IGroupSpacerStyleProps, IGroupSpacerStyles } from './GroupSpacer.types';
import { getStyles } from './GroupSpacer.styles';

const getClassNames = classNamesFunction<IGroupSpacerStyleProps, IGroupSpacerStyles>();
import { IGroupSpacerProps } from './GroupSpacer.types';

export const SPACER_WIDTH = 32;

export const GroupSpacer = styled<IGroupSpacerProps, IGroupSpacerStyleProps, IGroupSpacerStyles>(
(props: IGroupSpacerProps) => {
const { count, styles, theme, indentWidth = SPACER_WIDTH } = props;
const classNames = getClassNames(styles, {
theme: theme!,
width: count * indentWidth
});
export const GroupSpacer: React.SFC<IGroupSpacerProps> = (props: IGroupSpacerProps): ReturnType<React.SFC<IGroupSpacerProps>> => {
const { count, indentWidth = SPACER_WIDTH } = props;
const width = count * indentWidth;

return count > 0 ? <span className={classNames.root} /> : null;
},
getStyles,
undefined,
{ scope: 'GroupSpacer' }
);
return count > 0 ? <span className={'ms-GroupSpacer'} style={{ display: 'inline-block', width }} /> : null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { IStyleFunctionOrObject } from '../../Utilities';
export interface IGroupSpacerProps {
/**
* Theme from Higher Order Component
*
* @deprecated unused, to be removed in 7.0
*/
theme?: ITheme;

/**
* Style function to be passed in to override the themed or default styles
*
* @deprecated unused, to be removed in 7.0
*/
styles?: IStyleFunctionOrObject<IGroupSpacerStyleProps, IGroupSpacerStyles>;

Expand All @@ -19,10 +23,16 @@ export interface IGroupSpacerProps {
indentWidth?: number;
}

/**
* @deprecated unused, to be removed in 7.0. Use {@link IGroupSpacerProps.indentWidth}
*/
export type IGroupSpacerStyleProps = Required<Pick<IGroupSpacerProps, 'theme'>> & {
width?: number;
};

/**
* @deprecated unused, to be removed in 7.0.
*/
export interface IGroupSpacerStyles {
root: IStyle;
}