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": "Split PersonaCoin and PersonaPresence files for more consistency.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "jordancjanzen@gmail.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Move sub-components to sub-folders",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "jordanjanzen@jordanjanzen.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import {
getInitials,
getNativeProps,
getRTL,
styled,
} from '../../Utilities';
import { mergeStyles } from '../../Styling';
import { PersonaPresence } from './PersonaPresence';
} from '../../../Utilities';
import { mergeStyles } from '../../../Styling';
import { PersonaPresence } from '../PersonaPresence';
import {
Icon
} from '../../Icon';
Expand All @@ -26,9 +25,8 @@ import {
IPersonaPresenceProps,
PersonaPresence as PersonaPresenceEnum,
PersonaSize,
} from './Persona.types';
import { initialsColorPropToColorCode } from './PersonaInitialsColor';
import { getStyles } from './PersonaCoin.styles';
} from '../Persona.types';
import { initialsColorPropToColorCode } from '../PersonaInitialsColor';

const getClassNames = classNamesFunction<IPersonaCoinStyleProps, IPersonaCoinStyles>();

Expand Down Expand Up @@ -83,7 +81,7 @@ export class PersonaCoinBase extends BaseComponent<IPersonaCoinProps, IPersonaSt
className,
coinProps,
coinSize,
getStyles: getStylesProp, // Use getStyles from props.
getStyles,
imageUrl,
onRenderCoin = this._onRenderCoin,
onRenderInitials = this._onRenderInitials,
Expand All @@ -103,7 +101,7 @@ export class PersonaCoinBase extends BaseComponent<IPersonaCoinProps, IPersonaSt
};

// Use getStyles from props, or fall back to getStyles from styles file.
const classNames = getClassNames(getStylesProp, {
const classNames = getClassNames(getStyles, {
theme: theme!,
className: (coinProps && coinProps.className) ? coinProps.className : className,
size,
Expand Down Expand Up @@ -162,7 +160,7 @@ export class PersonaCoinBase extends BaseComponent<IPersonaCoinProps, IPersonaSt
private _onRenderCoin = (props: IPersonaCoinProps): JSX.Element | null => {
const {
coinSize,
getStyles: getStylesProp,
getStyles,
imageUrl,
imageAlt,
imageShouldFadeIn,
Expand All @@ -172,7 +170,7 @@ export class PersonaCoinBase extends BaseComponent<IPersonaCoinProps, IPersonaSt

const size = this.props.size as PersonaSize;

const classNames = getClassNames(getStylesProp, {
const classNames = getClassNames(getStyles, {
theme: theme!,
size
});
Expand Down Expand Up @@ -219,11 +217,3 @@ export class PersonaCoinBase extends BaseComponent<IPersonaCoinProps, IPersonaSt
this.props.onPhotoLoadingStateChange && this.props.onPhotoLoadingStateChange(loadState);
}
}

/**
* PersonaCoin is used to render an individual's avatar and presence.
*/
export const PersonaCoin = styled<IPersonaCoinProps, IPersonaCoinStyleProps, IPersonaCoinStyles>(
PersonaCoinBase,
getStyles
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import {
IPersonaCoinStyleProps,
IPersonaCoinStyles,
PersonaSize,
} from './Persona.types';
} from '../Persona.types';
import {
HighContrastSelector,
FontSizes,
FontWeights,
} from '../../Styling';
} from '../../../Styling';
import {
personaSize,
sizeBoolean,
} from './PersonaConsts';
} from '../PersonaConsts';

export const getStyles = (
props: IPersonaCoinStyleProps
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { styled } from '../../../Utilities';
import {
IPersonaCoinProps,
IPersonaCoinStyleProps,
IPersonaCoinStyles
} from '../Persona.types';
import { PersonaCoinBase } from './PersonaCoin.base';
import { getStyles } from './PersonaCoin.styles';

/**
* PersonaCoin is used to render an individual's avatar and presence.
*/
export const PersonaCoin = styled<IPersonaCoinProps, IPersonaCoinStyleProps, IPersonaCoinStyles>(
PersonaCoinBase,
getStyles
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './PersonaCoin';
export * from './PersonaCoin.base';
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ import {
BaseComponent,
classNamesFunction,
customizable,
styled,
} from '../../Utilities';
import { IStyleSet } from '../../Styling';
} from '../../../Utilities';
import { IStyleSet } from '../../../Styling';
import { Icon } from '../../Icon';
import {
IPersonaPresenceProps,
IPersonaPresenceStyleProps,
IPersonaPresenceStyles,
PersonaPresence as PersonaPresenceEnum,
PersonaSize,
} from './Persona.types';
import { sizeBoolean } from './PersonaConsts';
import { getStyles } from './PersonaPresence.styles';
} from '../Persona.types';
import { sizeBoolean } from '../PersonaConsts';

const coinSizeFontScaleFactor = 6;
const coinSizePresenceScaleFactor = 3;
Expand All @@ -37,7 +35,7 @@ export class PersonaPresenceBase extends BaseComponent<IPersonaPresenceProps, {}
public render(): JSX.Element | null {
const {
coinSize,
getStyles: getStylesProp, // Use getStyles from props.
getStyles, // Use getStyles from props.
presence,
theme,
} = this.props;
Expand All @@ -52,7 +50,7 @@ export class PersonaPresenceBase extends BaseComponent<IPersonaPresenceProps, {}
const coinSizeWithPresenceStyle = coinSize ? { width: presenceHeightWidth, height: presenceHeightWidth } : undefined;

// Use getStyles from props, or fall back to getStyles from styles file.
const classNames = getClassNames(getStylesProp, {
const classNames = getClassNames(getStyles, {
theme: theme!,
presence,
size: this.props.size,
Expand Down Expand Up @@ -104,11 +102,3 @@ export class PersonaPresenceBase extends BaseComponent<IPersonaPresenceProps, {}
}
}
}

/**
* PersonaPresence is used to render an individual's presence.
*/
export const PersonaPresence = styled<IPersonaPresenceProps, IPersonaPresenceStyleProps, IPersonaPresenceStyles>(
PersonaPresenceBase,
getStyles
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import {
IPersonaPresenceStyles,
PersonaPresence,
PersonaSize,
} from './Persona.types';
} from '../Persona.types';
import {
FontSizes,
HighContrastSelector,
} from '../../Styling';
} from '../../../Styling';
import {
personaPresenceSize,
presenceBoolean,
sizeBoolean,
} from './PersonaConsts';
} from '../PersonaConsts';

export const getStyles = (
props: IPersonaPresenceStyleProps
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { styled } from '../../../Utilities';
import {
IPersonaPresenceProps,
IPersonaPresenceStyleProps,
IPersonaPresenceStyles
} from '../Persona.types';
import { PersonaPresenceBase } from './PersonaPresence.base';
import { getStyles } from './PersonaPresence.styles';

/**
* PersonaPresence is used to render an individual's presence.
*/
export const PersonaPresence = styled<IPersonaPresenceProps, IPersonaPresenceStyleProps, IPersonaPresenceStyles>(
PersonaPresenceBase,
getStyles
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './PersonaPresence';
export * from './PersonaPresence.base';