Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring module css for PeoplePicker. #1069

Merged
merged 5 commits into from
Feb 27, 2017
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,8 @@
{
"changes": [{
"packageName": "office-ui-fabric-react",
"comment": "Update People Picker with module css.",
"type": "patch"
}],
"email": "luh@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
@import '../../../common/common';

:global {

.ms-PickerPersona-Container {
display: inline-block;
}

.ms-Picker-MenuItem.ms-result-content{
display: table-row;
.ms-result-item {
display: table-cell;
vertical-align: bottom;
}
.resultContent {
display: table-row;
.resultItem {
display: table-cell;
vertical-align: bottom;
}
}

.ms-PeoplePicker-Persona {
width: 180px;

.ms-Persona-details {
width: 100%;
}
.peoplePickerPersona {
width: 180px;
:global(.ms-Persona-details) {
width: 100%;
}
}

.ms-PeoplePicker {
.ms-BasePicker-text {
min-height: 40px;
}
.peoplePicker {
:global(.ms-BasePicker-text) {
min-height: 40px;
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
@import '../../../../common/common';

:global {
.ms-PickerPersona-container {
@include focus-border();

display: inline-flex;
align-items: center;
background: $ms-color-neutralLighter;
margin: 1px;
cursor: default;
user-select: none;
max-width: 100%;

.personaContainer {
@include focus-border();
display: inline-flex;
align-items: center;
background: $ms-color-neutralLighter;
margin: 1px;
cursor: default;
user-select: none;
max-width: 100%;
&:hover {
background: $ms-color-neutralLight;
}
&.personaContainerIsSelected {
background: $ms-color-neutralQuaternary;
&:hover {
background: $ms-color-neutralLight;
}

&.is-selected {
background: $ms-color-neutralQuaternary;
&:hover {
background: $ms-color-neutralQuaternaryAlt;
}
}

.ms-PickerItem-content {
flex: 0 1 auto;
min-width: 0px;
&.ms-Button {
flex: 0 0 auto;
}
background: $ms-color-neutralQuaternaryAlt;
}

.ms-Persona-details {
flex: 0 1 auto;
}
.itemContent {
flex: 0 1 auto;
min-width: 0px;
&:global(.ms-Button) {
flex: 0 0 auto;
}
}

.ms-PickerItem-container {
display: inline-block;
.personaDetails {
flex: 0 1 auto;
}
}

.itemContainer {
display: inline-block;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { css } from '../../../../Utilities';
import { Persona, PersonaSize, PersonaPresence } from '../../../../Persona';
import { IPeoplePickerItemProps } from './PeoplePickerItem.Props';
import { Button, ButtonType } from '../../../../Button';
import './PickerItemsDefault.scss';
import styles from './PickerItemsDefault.scss';

export const SelectedItemDefault: (props: IPeoplePickerItemProps) => JSX.Element = (peoplePickerItemProps: IPeoplePickerItemProps) => {
let {
Expand All @@ -16,12 +16,12 @@ export const SelectedItemDefault: (props: IPeoplePickerItemProps) => JSX.Element
} = peoplePickerItemProps;
return (
<div
className={ css('ms-PickerPersona-container', {
'is-selected': selected
className={ css('ms-PickerPersona-container', styles.personaContainer, {
['is-selected ' + styles.personaContainerIsSelected]: selected
}) }
data-is-focusable={ true }
data-selection-index={ index } >
<div className='ms-PickerItem-content'>
<div className={ css('ms-PickerItem-content', styles.itemContent) } >
<Persona
{ ...item }
presence={ item.presence !== undefined ? item.presence : PersonaPresence.none }
Expand All @@ -32,10 +32,10 @@ export const SelectedItemDefault: (props: IPeoplePickerItemProps) => JSX.Element
onClick={ () => { if (onRemoveItem) { onRemoveItem(); } } }
icon={ 'Cancel' }
buttonType={ ButtonType.icon }
className='ms-PickerItem-content'
className={ css('ms-PickerItem-content', styles.itemContent) }
data-is-focusable={ false }
>
</Button>
</div >
);
};
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* tslint:disable */
import * as React from 'react';
/* tslint:enable */
import { css } from '../../../../Utilities';
import { IPeoplePickerItemWithMenuProps } from './PeoplePickerItem.Props';
import { Persona, PersonaPresence } from '../../../../Persona';
import { ContextualMenu, DirectionalHint } from '../../../../ContextualMenu';
import { Button, ButtonType } from '../../../../Button';
import { FocusZone } from '../../../../FocusZone';
import styles from './PickerItemsDefault.scss';

export interface IPeoplePickerItemState {
contextualMenuVisible: boolean;
Expand All @@ -30,21 +32,21 @@ export class SelectedItemWithMenu extends React.Component<IPeoplePickerItemWithM
onRemoveItem
} = this.props;
return (
<div data-is-focusable={ true } className='ms-PickerItem-container'>
<FocusZone className='ms-PickerPersona-container' >
<div className='ms-PickerItem-content'>
<div data-is-focusable={ true } className={ css('ms-PickerItem-container', styles.itemContainer) }>
<FocusZone className={ css('ms-PickerPersona-container', styles.personaContainer) } >
<div className={ css('ms-PickerItem-content', styles.itemContent) }>
<Persona
{ ...item }
presence={ item.presence !== undefined ? item.presence : PersonaPresence.none }
/>
</div>
<div ref='ellipsisRef' className='ms-PickerItem-content'>
<div ref='ellipsisRef' className={ css('ms-PickerItem-content', styles.itemContent) }>
<Button
icon={ 'More' }
buttonType={ ButtonType.icon } onClick={ this.onContextualMenu }
/>
</div>
<div className='ms-PickerItem-content'>
<div className={ css('ms-PickerItem-content', styles.itemContent) }>
<Button
icon={ 'Cancel' }
buttonType={ ButtonType.icon }
Expand All @@ -71,4 +73,4 @@ export class SelectedItemWithMenu extends React.Component<IPeoplePickerItemWithM
private _onCloseContextualMenu(ev: Event) {
this.setState({ contextualMenuVisible: false });
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
/* tslint:disable */
import * as React from 'react';
/* tslint:enable */
import { css } from '../../../../Utilities';
import { Persona, PersonaSize, IPersonaProps, PersonaPresence } from '../../../../Persona';
import styles from '../PeoplePicker.scss';

export const SuggestionItemNormal: (persona: IPersonaProps) => JSX.Element = (personaProps: IPersonaProps) => {
return (
<div className='ms-PeoplePicker-personaContent'>
<Persona
{ ...personaProps }
presence={ personaProps.presence !== undefined ? personaProps.presence : PersonaPresence.none }
size={ PersonaSize.small }
className={ 'ms-PeoplePicker-Persona' }
/>
className={ css('ms-PeoplePicker-Persona', styles.peoplePickerPersona) }
/>
</div>
);
};
Expand All @@ -22,8 +25,8 @@ export const SuggestionItemSmall: (persona: IPersonaProps) => JSX.Element = (per
{ ...personaProps }
presence={ personaProps.presence !== undefined ? personaProps.presence : PersonaPresence.none }
size={ PersonaSize.extraSmall }
className={ 'ms-PeoplePicker-Persona' }
/>
className={ css('ms-PeoplePicker-Persona', styles.peoplePickerPersona) }
/>
</div>
);
};
};