Skip to content

Commit 4299eeb

Browse files
committed
support of additional file formats for FileTypeIcon in Image mode
1 parent ab4bf01 commit 4299eeb

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

src/controls/fileTypeIcon/FileTypeIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export class FileTypeIcon extends React.Component<IFileTypeIconProps, {}> {
227227
if (iconImage.cdnFallback) {
228228
const iconUrl = `${ICON_CDN_URL}/${iconImage.size.replace("icon", "")}/${iconImage.cdnFallback}.png`;
229229
iconElm = <Icon iconType={IconUIType.image} imageProps={{ src: iconUrl }} />;
230-
} else if (iconImage.cdnFallback) {
230+
} else if (iconImage.image) {
231231
iconElm = <Icon iconType={IconUIType.image} imageProps={{ className: `ms-BrandIcon--${iconImage.size} ms-BrandIcon--${iconImage.image}` }} />;
232232
} else {
233233
// Return a generic image

src/controls/fileTypeIcon/IFileTypeIcon.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,22 @@ export const ApplicationIconList: IApplicationIcons[] = [
6666
application: ApplicationType.ASPX,
6767
extensions: ['aspx', 'master'],
6868
iconName: 'FileASPX',
69-
imageName: []
69+
imageName: [],
70+
cdnImageName: ['spo']
7071
},
7172
{
7273
application: ApplicationType.Code,
7374
extensions: ['js', 'ts', 'cs'],
7475
iconName: 'FileCode',
75-
imageName: []
76+
imageName: [],
77+
cdnImageName: ['code']
7678
},
7779
{
7880
application: ApplicationType.CSS,
7981
extensions: ['css'],
8082
iconName: 'FileCSS',
81-
imageName: []
83+
imageName: [],
84+
cdnImageName: ['code']
8285
},
8386
{
8487
application: ApplicationType.CSV,
@@ -98,19 +101,22 @@ export const ApplicationIconList: IApplicationIcons[] = [
98101
application: ApplicationType.HTML,
99102
extensions: ['html'],
100103
iconName: 'FileHTML',
101-
imageName: []
104+
imageName: [],
105+
cdnImageName: ['html']
102106
},
103107
{
104108
application: ApplicationType.Image,
105109
extensions: ['jpg', 'jpeg', 'gif', 'png'],
106110
iconName: 'FileImage',
107-
imageName: []
111+
imageName: [],
112+
cdnImageName: ['photo']
108113
},
109114
{
110115
application: ApplicationType.Mail,
111116
extensions: ['msg'],
112117
iconName: 'Mail',
113-
imageName: []
118+
imageName: [],
119+
cdnImageName: ['email']
114120
},
115121
{
116122
application: ApplicationType.OneNote,
@@ -157,7 +163,8 @@ export const ApplicationIconList: IApplicationIcons[] = [
157163
application: ApplicationType.SASS,
158164
extensions: ['scss', 'sass'],
159165
iconName: 'FileSass',
160-
imageName: []
166+
imageName: [],
167+
cdnImageName: ['code']
161168
},
162169
{
163170
application: ApplicationType.Visio,

src/webparts/controlsTest/ControlsTestWebPart.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export default class ControlsTestWebPart extends BaseClientSideWebPart<IControls
2727
displayMode: this.displayMode,
2828
updateProperty: (value: string) => {
2929
this.properties.title = value;
30-
}
30+
},
31+
totalPages: this.properties.totalPages
3132
}
3233
);
3334

@@ -51,6 +52,9 @@ export default class ControlsTestWebPart extends BaseClientSideWebPart<IControls
5152
groupFields: [
5253
PropertyPaneTextField('description', {
5354
label: strings.DescriptionFieldLabel
55+
}),
56+
PropertyPaneTextField('totalPages', {
57+
label: 'Total pages in pagination'
5458
})
5559
]
5660
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface IControlsTestWebPartProps {
22
title: string;
33
description: string;
4+
totalPages: number;
45
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
12621262
<Pagination
12631263
currentPage={3}
12641264
onChange={(page) => (this._getPage(page))}
1265-
totalPages={13}
1265+
totalPages={this.props.totalPages || 13}
12661266
//limiter={3}
12671267
// hideFirstPageJump
12681268
//hideLastPageJump

src/webparts/controlsTest/components/IControlsTestProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface IControlsTestProps {
1010
title: string;
1111
displayMode: DisplayMode;
1212
updateProperty: (value: string) => void;
13+
totalPages?: number;
1314
}
1415

1516
export interface IControlsTestState {

0 commit comments

Comments
 (0)