Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions src/components/Persona/Persona.Props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export interface IPersonaProps extends React.HTMLProps<Persona> {
*/
secondaryText?: string;

/**
* Optional control to display/update, usually the role of the user.
*/
innerControl?: JSX.Element;
Copy link
Member

Choose a reason for hiding this comment

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

delete this.


/**
* Tertiary text to display, usually the status of the user.
*/
Expand Down
50 changes: 49 additions & 1 deletion src/components/Persona/Persona.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,14 @@ $ms-color-initials-darkRed: #b91d47;
border: 2px solid $ms-color-white;
}

.ms-Persona-detailsWithInnerControl,
.ms-Persona-details {
display: table-cell;
padding: 0 12px;
vertical-align: middle;
}

.ms-Persona-details {
overflow: hidden;
}

Expand All @@ -171,7 +175,8 @@ $ms-color-initials-darkRed: #b91d47;

.ms-Persona-secondaryText,
.ms-Persona-tertiaryText,
.ms-Persona-optionalText {
.ms-Persona-optionalText,
.ms-Persona-detailsWithInnerControl {
color: $ms-color-neutralSecondary;
font-family: $ms-font-family-regular;
font-size: $ms-font-size-s;
Expand All @@ -183,6 +188,10 @@ $ms-color-initials-darkRed: #b91d47;
padding-top: 3px;
}

.ms-Persona-detailsWithInnerControl {
padding-top: 3px;
}

.ms-Persona-tertiaryText,
.ms-Persona-optionalText {
padding-top: 5px;
Expand Down Expand Up @@ -260,6 +269,10 @@ $ms-color-initials-darkRed: #b91d47;
.ms-Persona-secondaryText {
display: none;
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand All @@ -274,6 +287,10 @@ $ms-color-initials-darkRed: #b91d47;
.ms-Persona-primaryText:after {
content: ';';
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand All @@ -285,6 +302,10 @@ $ms-color-initials-darkRed: #b91d47;
width: 12px;
top: 10px;
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand Down Expand Up @@ -334,6 +355,9 @@ $ms-color-initials-darkRed: #b91d47;
width: 4px;
left: 0;
}
.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand Down Expand Up @@ -372,6 +396,10 @@ $ms-color-initials-darkRed: #b91d47;
.ms-Persona-secondaryText {
padding-top: 1px;
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand All @@ -383,6 +411,10 @@ $ms-color-initials-darkRed: #b91d47;
width: 4px;
left: 0;
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand Down Expand Up @@ -420,6 +452,10 @@ $ms-color-initials-darkRed: #b91d47;
.ms-Persona-tertiaryText {
display: block; // Show tertiary text
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand All @@ -431,6 +467,10 @@ $ms-color-initials-darkRed: #b91d47;
width: 7px;
left: 0;
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand Down Expand Up @@ -478,6 +518,10 @@ $ms-color-initials-darkRed: #b91d47;
padding-top: 5px;
display: block; // Show tertiary and optional text
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand All @@ -489,6 +533,10 @@ $ms-color-initials-darkRed: #b91d47;
width: 9px;
left: 0;
}

.ms-Persona-detailsWithInnerControl {
display: none;
}
}


Expand Down
13 changes: 8 additions & 5 deletions src/components/Persona/Persona.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export class Persona extends React.Component<IPersonaProps, any> {
};

public render() {
let { className, size, imageUrl, imageInitials, initialsColor, presence, primaryText, secondaryText, tertiaryText, optionalText, hidePersonaDetails } = this.props;
let { className, size, imageUrl, imageInitials, initialsColor, presence, primaryText, secondaryText, tertiaryText, optionalText, hidePersonaDetails, innerControl } = this.props;
let personaDetailsClass = innerControl ? 'ms-Persona-detailsWithInnerControl' : 'ms-Persona-details';

return (
<div { ... this.props as any } className={ css('ms-Persona', className, PERSONA_SIZE[size], PERSONA_PRESENCE[presence]) }>
Expand All @@ -35,17 +36,19 @@ export class Persona extends React.Component<IPersonaProps, any> {
) }

{ presence !== PersonaPresence.none && <div className='ms-Persona-presence'></div> }

{ !hidePersonaDetails && (
<div className='ms-Persona-details'>
<div className= { personaDetailsClass }>
<div className='ms-Persona-primaryText'>{ primaryText }</div>
{ secondaryText ? (
<div className='ms-Persona-secondaryText'>{ secondaryText }</div>
) : (null) }
<div className='ms-Persona-tertiaryText'>{ tertiaryText }</div>
<div className='ms-Persona-optionalText'>{ optionalText }</div>
</div>) }
</div>
{ innerControl ? (
Copy link
Member

@dzearing dzearing Sep 1, 2016

Choose a reason for hiding this comment

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

Talked with @abenems , instead of this we will simply render { this.props.children } and let the caller do what they need here. This should greatly simplify this PR.

<div className='ms-Persona-detailsWithInnerControl'>{ innerControl }</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a different className here than what you use on the root div. We cannot assume they will always use the same styles. For example, right now you mark 'ms-Persona-detailsWithInnerControl' as display:none for some scenarios, you definitely do not want the root div to be display: none in those cases...

) : (null) }
</div>) }
</div>
);
}
}