Skip to content

Commit 62d2727

Browse files
committed
Peoplepicker control v1.0 ready with validation and properties
1 parent 9c15ea5 commit 62d2727

File tree

3 files changed

+17
-102
lines changed

3 files changed

+17
-102
lines changed

src/controls/peoplepicker/IPeoplePicker.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ export interface IPeoplePickerProps {
5050
* Directional Hint of tool tip
5151
*/
5252
tooltipDirectional? : DirectionalHint;
53+
/**
54+
* Class Name for the whole People picker control
55+
*/
56+
peoplePickerWPclassName?:string;
57+
/**
58+
* Class Name for the People picker control
59+
*/
60+
peoplePickerCntrlclassName?: string;
61+
/**
62+
* Class Name for the Error Section
63+
*/
64+
errorMessageclassName?: string;
5365
}
5466

5567
export interface IPeoplePickerState {
Lines changed: 2 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,3 @@
1-
.placeholder {
2-
display: -webkit-box;
3-
display: -ms-flexbox;
4-
display: flex;
5-
6-
.placeholderContainer {
7-
-webkit-box-align: center;
8-
-ms-flex-align: center;
9-
-ms-grid-row-align: center;
10-
align-items: center;
11-
color: "[theme:neutralSecondary, default: #666666]";
12-
background-color: "[theme:neutralLighter, default: #f4f4f4]";
13-
width: 100%;
14-
padding: 80px 0;
15-
16-
.placeholderHead {
17-
color: "[theme:neutralPrimary, default: #333333]";
18-
19-
.placeholderHeadContainer {
20-
height: 100%;
21-
white-space: nowrap;
22-
text-align: center;
23-
}
24-
25-
.placeholderIcon {
26-
display: inline-block;
27-
vertical-align: middle;
28-
white-space: normal;
29-
}
30-
31-
.placeholderText {
32-
display: inline-block;
33-
vertical-align: middle;
34-
white-space: normal
35-
}
36-
}
37-
38-
.placeholderDescription {
39-
width: 65%;
40-
vertical-align: middle;
41-
margin: 0 auto;
42-
text-align: center;
43-
44-
.placeholderDescriptionText {
45-
color: "[theme:neutralSecondary, default: #666666]";
46-
font-size: 17px;
47-
display: inline-block;
48-
margin: 24px 0;
49-
font-weight: 100;
50-
}
51-
52-
button {
53-
font-size: 14px;
54-
font-weight: 400;
55-
box-sizing: border-box;
56-
display: inline-block;
57-
text-align: center;
58-
cursor: pointer;
59-
vertical-align: top;
60-
min-width: 80px;
61-
height: 32px;
62-
background-color: "[theme:themePrimary, default: #0078d7]";
63-
color: #fff;
64-
user-select: none;
65-
outline: transparent;
66-
border-width: 1px;
67-
border-style: solid;
68-
border-color: transparent;
69-
border-image: initial;
70-
text-decoration: none;
71-
}
72-
}
73-
}
74-
}
75-
76-
[dir=ltr] .placeholder,
77-
[dir=rtl] .placeholder {
78-
79-
.placeholderContainer {
80-
81-
.placeholderHead {
82-
83-
.placeholderText {
84-
padding-left: 20px;
85-
}
86-
}
87-
}
88-
}
89-
90-
.placeholderOverlay {
91-
position: relative;
92-
height: 100%;
93-
z-index: 1;
94-
95-
.placeholderSpinnerContainer {
96-
position: relative;
97-
width: 100%;
98-
margin: 164px 0
99-
}
1+
.defaultClass {
2+
color : black;
1003
}

src/controls/peoplepicker/PeoplePickerComponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
4545
*/
4646
constructor(props: IPeoplePickerProps) {
4747
super(props);
48-
this.refs
4948
this.state = {
5049
selectedPersons: [],
5150
mostRecentlyUsedPersons: [],
@@ -240,13 +239,13 @@ private _convertResultsToPromise(results: IPersonaProps[]): Promise<IPersonaProp
240239
* Default React component render method
241240
*/
242241
public render(): React.ReactElement<IPeoplePickerProps> {
243-
const peoplepicker = <div id="people">{this.props.titleText}
242+
const peoplepicker = <div id="people" className={`${styles.defaultClass} ${this.props.peoplePickerWPclassName ? this.props.peoplePickerWPclassName : ''}`}> {this.props.titleText}
244243
<NormalPeoplePicker
245244
pickerSuggestionsProps= {suggestionProps}
246245
onResolveSuggestions={ this._onPersonFilterChanged }
247246
onEmptyInputFocus={ this._returnMostRecentlyUsedPerson }
248247
getTextFromItem={(peoplePersonaMenu: IPersonaProps) => peoplePersonaMenu.primaryText}
249-
className={ 'ms-PeoplePicker' }
248+
className={ `'ms-PeoplePicker' ${this.props.peoplePickerCntrlclassName ? this.props.peoplePickerCntrlclassName : ''}` }
250249
key={ 'normal' }
251250
onValidateInput={ this._validateInputPeople }
252251
removeButtonAriaLabel={ 'Remove' }
@@ -273,6 +272,7 @@ public render(): React.ReactElement<IPeoplePickerProps> {
273272
<MessageBar
274273
messageBarType={ MessageBarType.error }
275274
isMultiline={ false }
275+
className = {`${this.props.errorMessageclassName ? this.props.errorMessageclassName : ''}`}
276276
>
277277
{this.props.errorMessage}
278278
</MessageBar> : null

0 commit comments

Comments
 (0)