office-ui-fabric-react#ITheme TypeScript Examples
The following examples show how to use
office-ui-fabric-react#ITheme.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DarkCustomizations.ts From microsoft-teams-apps-growyourskills with MIT License | 6 votes |
DarkTheme: ITheme = createTheme({
palette: DarkDefaultPalette,
semanticColors: {
buttonText: DarkDefaultPalette.black,
buttonTextPressed: DarkDefaultPalette.neutralDark,
buttonTextHovered: DarkDefaultPalette.neutralPrimary,
disabledBackground: DarkDefaultPalette.neutralQuaternaryAlt,
inputBackgroundChecked: DarkDefaultPalette.themePrimary,
menuBackground: DarkDefaultPalette.neutralLighter,
menuItemBackgroundHovered: DarkDefaultPalette.neutralQuaternaryAlt,
menuItemBackgroundPressed: DarkDefaultPalette.neutralQuaternary,
menuDivider: DarkDefaultPalette.neutralTertiaryAlt,
menuIcon: DarkDefaultPalette.themeDarkAlt,
menuHeader: DarkDefaultPalette.black,
menuItemText: DarkDefaultPalette.neutralPrimary,
menuItemTextHovered: DarkDefaultPalette.neutralDark,
},
isInverted: true,
})
Example #2
Source File: PersonaCard.tsx From spfx-msgraph-peoplesearch with MIT License | 6 votes |
/**
*
*
* @private
* @returns {JSX.Element}
* @memberof PersonaCard
*/
private _PersonaCard(processedProps?: IPersonaCardProps): JSX.Element {
if (isEmpty(processedProps)) {
processedProps = this.determinePersonaConfig();
}
const persona: IPersonaSharedProps = {
theme: this.props.themeVariant as ITheme,
text: processedProps.text,
secondaryText: processedProps.secondaryText,
tertiaryText: processedProps.tertiaryText,
optionalText: processedProps.optionalText,
imageShouldFadeIn: false
};
if (!isEmpty(this.props.item.photoUrl)) {
persona.imageUrl = this.props.item.photoUrl;
}
return <Persona {...persona} size={parseInt(this.props.personaSize)} />;
}
Example #3
Source File: PeopleSearchBox.tsx From spfx-msgraph-peoplesearch with MIT License | 6 votes |
private renderBasicSearchBox(): JSX.Element {
return (
<div className={styles.searchBoxWrapper}>
<SearchBox
placeholder={strings.SearchInputPlaceholder}
theme={this.props.themeVariant as ITheme}
className={styles.searchTextField}
value={this.state.searchInputValue}
autoComplete="off"
onChange={(event, value) => this.setState({ searchInputValue: value })}
onSearch={() => this._onSearch(this.state.searchInputValue)}
onClear={() => this._onSearch('', true)}
/>
<div className={styles.searchButton}>
{this.state.searchInputValue &&
<IconButton
onClick={() => this._onSearch(this.state.searchInputValue)}
iconProps={{ iconName: 'Forward' }}
/>
}
</div>
</div>
);
}
Example #4
Source File: PeopleShimmerViewComponent.tsx From spfx-msgraph-peoplesearch with MIT License | 5 votes |
private _getPersonaCardShimmers(personaSize: number): JSX.Element {
const shimmerContent = <div
style={{
display: 'flex' ,
marginBottom: 15
}}
>
<div style={{
paddingTop: 8,
paddingRight: 16,
paddingBottom: 8,
width: '100%'
}}>
<Shimmer
theme={this.props.templateContext.themeVariant as ITheme}
customElementsGroup={
<div style={{ display: 'flex', marginTop: 10 }}>
<ShimmerElementsGroup
theme={this.props.templateContext.themeVariant as ITheme}
backgroundColor={this.props.templateContext.themeVariant.semanticColors.bodyBackground}
shimmerElements={[{ type: ElemType.circle, height: personaSize}, { type: ElemType.gap, width: 10, height: personaSize }]}
/>
<ShimmerElementsGroup
theme={this.props.templateContext.themeVariant as ITheme}
flexWrap={true}
backgroundColor={this.props.templateContext.themeVariant.semanticColors.bodyBackground}
width="100%"
shimmerElements={[
{ type: ElemType.line, width: '30%', height: 10, verticalAlign: 'center' },
{ type: ElemType.gap, width: '70%', height: personaSize/2 },
{ type: ElemType.line, width: '60%', height: 10, verticalAlign: 'top' },
{ type: ElemType.gap, width: '40%', height: (personaSize/2) }
]}
/>
</div>
}/>
</div>
</div>;
return shimmerContent;
}
Example #5
Source File: PeopleSearchContainer.tsx From spfx-msgraph-peoplesearch with MIT License | 4 votes |
/**
*
*
* @returns {React.ReactElement<IPeopleSearchContainerProps>}
* @memberof Directory
*/
public render(): React.ReactElement<IPeopleSearchContainerProps> {
const areResultsLoading = this.state.areResultsLoading;
const items = this.state.results[this.state.page - 1];
const hasError = this.state.hasError;
const errorMessage = this.state.errorMessage;
const { semanticColors }: IReadonlyTheme = this.props.themeVariant;
let renderWebPartTitle: JSX.Element = null;
let renderWebPartContent: JSX.Element = null;
let renderOverlay: JSX.Element = null;
let renderShimmerElements: JSX.Element = null;
let renderSearchBox: JSX.Element = null;
let renderPagination: JSX.Element = null;
// Loading behavior
if (areResultsLoading) {
if (!isEmpty(items.value)) {
renderOverlay = <div>
<Overlay isDarkThemed={false} theme={this.props.themeVariant as ITheme} className={styles.overlay}>
<Spinner size={SpinnerSize.medium} />
</Overlay>
</div>;
} else {
let templateContext = {
items: items,
resultCount: this.state.resultCount,
showPagination: this.props.showPagination,
showResultsCount: this.props.showResultsCount,
showBlank: this.props.showBlank && this.props.searchParameterOption !== SearchParameterOption.SearchBox,
showLPC: this.props.showLPC,
themeVariant: this.props.themeVariant,
pageSize: this.props.searchService.pageSize,
serviceScope: this.props.serviceScope
} as ITemplateContext;
templateContext = { ...templateContext, ...this.props.templateParameters };
renderShimmerElements = this.props.templateService.getShimmerTemplateComponent(this.props.selectedLayout, templateContext);
}
}
// WebPart title
renderWebPartTitle = <WebPartTitle displayMode={this.props.displayMode} title={this.props.webPartTitle} updateProperty={(value: string) => this.props.updateWebPartTitle(value)} />;
// WebPart content
if (isEmpty(items.value) && this.props.showBlank && this.props.selectedLayout !== ResultsLayoutOption.Debug && this.props.searchParameterOption !== SearchParameterOption.SearchBox) {
if (this.props.displayMode === DisplayMode.Edit) {
renderWebPartContent = <MessageBar messageBarType={MessageBarType.info}>{strings.ShowBlankEditInfoMessage}</MessageBar>;
}
else {
renderWebPartTitle = null;
}
} else {
let templateContext = {
items: items,
resultCount: this.state.resultCount,
showPagination: this.props.showPagination,
showResultsCount: this.props.showResultsCount,
showBlank: this.props.showBlank && this.props.searchParameterOption !== SearchParameterOption.SearchBox,
showLPC: this.props.showLPC,
themeVariant: this.props.themeVariant,
pageSize: this.props.searchService.pageSize,
serviceScope: this.props.serviceScope
} as ITemplateContext;
templateContext = { ...templateContext, ...this.props.templateParameters };
let renderSearchResultTemplate = this.props.templateService.getTemplateComponent(this.props.selectedLayout, templateContext);
if (this.props.searchParameterOption === SearchParameterOption.SearchBox) {
renderSearchBox = <PeopleSearchBox themeVariant={this.props.themeVariant} onSearch={(searchQuery) => { this.props.updateSearchParameter(searchQuery); }} searchInputValue={this.props.searchService.searchParameter} />;
}
if (this.props.showPagination) {
let prevPageEl: JSX.Element = null;
let nextPageEl: JSX.Element = null;
if (this.hasPreviousPage()) {
prevPageEl = <IconButton onClick={async () => await this._fetchPeopleSearchResults(this.state.page - 1)} iconProps={{ iconName: 'DoubleChevronLeft8' }} />;
}
if (this.hasNextPage()) {
nextPageEl = <IconButton onClick={async () => await this._fetchPeopleSearchResults(this.state.page + 1)} iconProps={{ iconName: 'DoubleChevronRight8' }} />;
}
renderPagination =
<div className={styles.searchPagination}>
{prevPageEl}
{nextPageEl}
</div>;
}
renderWebPartContent =
<React.Fragment>
{renderOverlay}
{renderSearchBox}
{renderSearchResultTemplate}
{renderPagination}
</React.Fragment>;
}
// Error Message
if (hasError) {
renderWebPartContent = <MessageBar messageBarType={MessageBarType.error}>{errorMessage}</MessageBar>;
}
return (
<div style={{backgroundColor: semanticColors.bodyBackground}}>
<div className={styles.peopleSearchWebPart}>
{renderWebPartTitle}
{renderShimmerElements ? renderShimmerElements : renderWebPartContent}
</div>
</div>
);
}