Skip to content

Commit

Permalink
Merge pull request #640 from pnp/additional-formats
Browse files Browse the repository at this point in the history
Additional formats for FileTypeIcon
  • Loading branch information
AJIXuMuK committed Aug 22, 2020
2 parents ab4bf01 + 4299eeb commit 49f33bc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/controls/fileTypeIcon/FileTypeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class FileTypeIcon extends React.Component<IFileTypeIconProps, {}> {
if (iconImage.cdnFallback) {
const iconUrl = `${ICON_CDN_URL}/${iconImage.size.replace("icon", "")}/${iconImage.cdnFallback}.png`;
iconElm = <Icon iconType={IconUIType.image} imageProps={{ src: iconUrl }} />;
} else if (iconImage.cdnFallback) {
} else if (iconImage.image) {
iconElm = <Icon iconType={IconUIType.image} imageProps={{ className: `ms-BrandIcon--${iconImage.size} ms-BrandIcon--${iconImage.image}` }} />;
} else {
// Return a generic image
Expand Down
21 changes: 14 additions & 7 deletions src/controls/fileTypeIcon/IFileTypeIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,22 @@ export const ApplicationIconList: IApplicationIcons[] = [
application: ApplicationType.ASPX,
extensions: ['aspx', 'master'],
iconName: 'FileASPX',
imageName: []
imageName: [],
cdnImageName: ['spo']
},
{
application: ApplicationType.Code,
extensions: ['js', 'ts', 'cs'],
iconName: 'FileCode',
imageName: []
imageName: [],
cdnImageName: ['code']
},
{
application: ApplicationType.CSS,
extensions: ['css'],
iconName: 'FileCSS',
imageName: []
imageName: [],
cdnImageName: ['code']
},
{
application: ApplicationType.CSV,
Expand All @@ -98,19 +101,22 @@ export const ApplicationIconList: IApplicationIcons[] = [
application: ApplicationType.HTML,
extensions: ['html'],
iconName: 'FileHTML',
imageName: []
imageName: [],
cdnImageName: ['html']
},
{
application: ApplicationType.Image,
extensions: ['jpg', 'jpeg', 'gif', 'png'],
iconName: 'FileImage',
imageName: []
imageName: [],
cdnImageName: ['photo']
},
{
application: ApplicationType.Mail,
extensions: ['msg'],
iconName: 'Mail',
imageName: []
imageName: [],
cdnImageName: ['email']
},
{
application: ApplicationType.OneNote,
Expand Down Expand Up @@ -157,7 +163,8 @@ export const ApplicationIconList: IApplicationIcons[] = [
application: ApplicationType.SASS,
extensions: ['scss', 'sass'],
iconName: 'FileSass',
imageName: []
imageName: [],
cdnImageName: ['code']
},
{
application: ApplicationType.Visio,
Expand Down
6 changes: 5 additions & 1 deletion src/webparts/controlsTest/ControlsTestWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default class ControlsTestWebPart extends BaseClientSideWebPart<IControls
displayMode: this.displayMode,
updateProperty: (value: string) => {
this.properties.title = value;
}
},
totalPages: this.properties.totalPages
}
);

Expand All @@ -51,6 +52,9 @@ export default class ControlsTestWebPart extends BaseClientSideWebPart<IControls
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
}),
PropertyPaneTextField('totalPages', {
label: 'Total pages in pagination'
})
]
}
Expand Down
1 change: 1 addition & 0 deletions src/webparts/controlsTest/IControlsTestWebPartProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface IControlsTestWebPartProps {
title: string;
description: string;
totalPages: number;
}
2 changes: 1 addition & 1 deletion src/webparts/controlsTest/components/ControlsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
<Pagination
currentPage={3}
onChange={(page) => (this._getPage(page))}
totalPages={13}
totalPages={this.props.totalPages || 13}
//limiter={3}
// hideFirstPageJump
//hideLastPageJump
Expand Down
1 change: 1 addition & 0 deletions src/webparts/controlsTest/components/IControlsTestProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface IControlsTestProps {
title: string;
displayMode: DisplayMode;
updateProperty: (value: string) => void;
totalPages?: number;
}

export interface IControlsTestState {
Expand Down

0 comments on commit 49f33bc

Please sign in to comment.