Skip to content
Closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Removing use of borderStyle prop of Shimmer subcomponents Line, Circle, Gap in favor of using mergeStyles API.",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ShimmerCircleBase extends BaseComponent<IShimmerCircleProps, {}> {
}

public render(): JSX.Element {
const { height, styles, borderStyle, theme } = this.props;
const { height, styles, theme, borderStyle } = this.props;
this._classNames = getClassNames(styles!, {
theme: theme!,
height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ const GlobalClassNames = {
};

export function getStyles(props: IShimmerCircleStyleProps): IShimmerCircleStyles {
const { height, borderStyle, theme } = props;
const { height, theme, borderStyle } = props;

const { palette } = theme;
const classNames = getGlobalClassNames(GlobalClassNames, theme);

const styles: IRawStyle = !!borderStyle ? borderStyle : {};
const borderStyles: IRawStyle = !!borderStyle ? borderStyle : {};

return {
root: [
classNames.root,
styles,
{
width: `${height}px`,
height: `${height}px`,
Expand All @@ -31,7 +30,8 @@ export function getStyles(props: IShimmerCircleStyleProps): IShimmerCircleStyles
borderColor: 'Window'
}
}
}
},
borderStyles
],
svg: [
classNames.svg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export interface IShimmerCircleProps extends React.AllHTMLAttributes<HTMLElement
*/
height?: number;

/**
* Used to
*/
borderStyle?: IRawStyle;

/**
* Theme provided by High-Order Component.
*/
Expand All @@ -34,6 +29,12 @@ export interface IShimmerCircleProps extends React.AllHTMLAttributes<HTMLElement
* Call to provide customized styling that will layer on top of the variant rules.
*/
styles?: IStyleFunctionOrObject<IShimmerCircleStyleProps, IShimmerCircleStyles>;

/**
* Sets custom styling of the shimmerCircle borders.
* @deprecated Use 'styles' prop to leverage mergeStyle API.
*/
borderStyle?: IRawStyle;
}

export interface IShimmerCircleStyleProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import {
import { IRawStyle } from '../../../Styling';
import { ShimmerElementType, ShimmerElementsDefaultHeights, IShimmerElement } from '../Shimmer.types';
import { ShimmerLine } from '../ShimmerLine/ShimmerLine';
import { IShimmerLineStyles } from '../ShimmerLine/ShimmerLine.types';
import { ShimmerGap } from '../ShimmerGap/ShimmerGap';
import { IShimmerGapStyles } from '../ShimmerGap/ShimmerGap.types';
import { ShimmerCircle } from '../ShimmerCircle/ShimmerCircle';
import { IShimmerCircleStyles } from '../ShimmerCircle/ShimmerCircle.types';

const getClassNames = classNamesFunction<IShimmerElementsGroupStyleProps, IShimmerElementsGroupStyles>();

Expand Down Expand Up @@ -49,24 +52,25 @@ export class ShimmerElementsGroupBase extends BaseComponent<IShimmerElementsGrou
const { type, ...filteredElem } = elem;
switch (elem.type) {
case ShimmerElementType.circle:
return (
<ShimmerCircle key={index} {...filteredElem} borderStyle={this._getBorderStyles(elem, rowHeight)} />
);
return <ShimmerCircle key={index} {...filteredElem} styles={this._getBorderStyles(elem, rowHeight)} />;
case ShimmerElementType.gap:
return <ShimmerGap key={index} {...filteredElem} borderStyle={this._getBorderStyles(elem, rowHeight)} />;
return <ShimmerGap key={index} {...filteredElem} styles={this._getBorderStyles(elem, rowHeight)} />;
case ShimmerElementType.line:
return <ShimmerLine key={index} {...filteredElem} borderStyle={this._getBorderStyles(elem, rowHeight)} />;
return <ShimmerLine key={index} {...filteredElem} styles={this._getBorderStyles(elem, rowHeight)} />;
}
}
)
) : (
<ShimmerLine height={ShimmerElementsDefaultHeights.line} />
<ShimmerLine height={ShimmerElementsDefaultHeights.line} styles={{ root: [{ borderWidth: '0px' }] }} />
);

return renderedElements;
};

private _getBorderStyles = (elem: IShimmerElement, rowHeight?: number): IRawStyle | undefined => {
private _getBorderStyles = (
elem: IShimmerElement,
rowHeight?: number
): IShimmerCircleStyles | IShimmerGapStyles | IShimmerLineStyles => {
const elemHeight: number | undefined = elem.height;
const dif: number = rowHeight && elemHeight ? rowHeight - elemHeight : 0;

Expand All @@ -89,7 +93,9 @@ export class ShimmerElementsGroupBase extends BaseComponent<IShimmerElementsGrou
};
}

return borderStyle;
return {
root: [{ ...borderStyle }]
};
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ShimmerGapBase extends BaseComponent<IShimmerGapProps, {}> {
}

public render(): JSX.Element {
const { height, styles, width, borderStyle, theme } = this.props;
const { height, styles, width, theme, borderStyle } = this.props;

this._classNames = getClassNames(styles!, {
theme: theme!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ const GlobalClassNames = {
};

export function getStyles(props: IShimmerGapStyleProps): IShimmerGapStyles {
const { height, borderStyle, theme } = props;
const { height, theme, borderStyle } = props;

const { palette } = theme;
const classNames = getGlobalClassNames(GlobalClassNames, theme);

const styles: IRawStyle = !!borderStyle ? borderStyle : {};
const borderStyles: IRawStyle = !!borderStyle ? borderStyle : {};

return {
root: [
classNames.root,
styles,
{
backgroundColor: palette.white,
height: `${height}px`,
Expand All @@ -30,7 +29,8 @@ export function getStyles(props: IShimmerGapStyleProps): IShimmerGapStyles {
borderColor: 'Window'
}
}
}
},
borderStyles
]
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export interface IShimmerGapProps extends React.AllHTMLAttributes<HTMLElement> {
*/
width?: number | string;

/**
* Sets custom styling of the gap.
*/
borderStyle?: IRawStyle;

/**
* Theme provided by High-Order Component.
*/
Expand All @@ -40,6 +35,12 @@ export interface IShimmerGapProps extends React.AllHTMLAttributes<HTMLElement> {
* Call to provide customized styling that will layer on top of the variant rules.
*/
styles?: IStyleFunctionOrObject<IShimmerGapStyleProps, IShimmerGapStyles>;

/**
* Sets custom styling of the shimmerGap borders.
* @deprecated Use 'styles' prop to leverage mergeStyle API.
*/
borderStyle?: IRawStyle;
}

export interface IShimmerGapStyleProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ShimmerLineBase extends BaseComponent<IShimmerLineProps, {}> {
}

public render(): JSX.Element {
const { height, styles, width, borderStyle, theme } = this.props;
const { height, styles, width, theme, borderStyle } = this.props;

this._classNames = getClassNames(styles!, {
theme: theme!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const GlobalClassNames = {
};

export function getStyles(props: IShimmerLineStyleProps): IShimmerLineStyles {
const { height, borderStyle, theme } = props;
const { height, theme, borderStyle } = props;

const { palette } = theme;
const classNames = getGlobalClassNames(GlobalClassNames, theme);

const styles: IRawStyle = !!borderStyle ? borderStyle : { borderWidth: '0px' };
const borderStyles: IRawStyle = !!borderStyle ? borderStyle : { borderWidth: '0px' };

const sharedCornerStyles: IRawStyle = {
position: 'absolute',
Expand All @@ -25,7 +25,6 @@ export function getStyles(props: IShimmerLineStyleProps): IShimmerLineStyles {
return {
root: [
classNames.root,
styles,
{
height: `${height}px`,
boxSizing: 'content-box',
Expand All @@ -43,7 +42,8 @@ export function getStyles(props: IShimmerLineStyleProps): IShimmerLineStyles {
}
}
}
}
},
borderStyles
],
topLeftCorner: [
classNames.topLeftCorner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export interface IShimmerLineProps extends React.AllHTMLAttributes<HTMLElement>
*/
width?: number | string;

/**
* Sets custom styling of the rectangle.
*/
borderStyle?: IRawStyle;

/**
* Theme provided by High-Order Component.
*/
Expand All @@ -40,6 +35,12 @@ export interface IShimmerLineProps extends React.AllHTMLAttributes<HTMLElement>
* Call to provide customized styling that will layer on top of the variant rules.
*/
styles?: IStyleFunctionOrObject<IShimmerLineStyleProps, IShimmerLineStyles>;

/**
* Sets custom styling of the shimmerLine borders.
* @deprecated Use styles prop to leverage mergeStyle API.
*/
borderStyle?: IRawStyle;
}

export interface IShimmerLineStyleProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class TooltipHost extends BaseComponent<ITooltipHostProps, ITooltipHostSt
(tooltipProps && tooltipProps.onRenderContent && tooltipProps.onRenderContent())
);
const showTooltip = isTooltipVisible && isContentPresent;
const ariaDescribedBy = (setAriaDescribedBy && isTooltipVisible && isContentPresent) ? tooltipId : undefined;
const ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && isContentPresent ? tooltipId : undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line was changed by the auto formatter (prettier) after merging a fresh master and resolving the conflicts.


return (
<div
Expand Down