diff --git a/src/declarations.d.ts b/src/declarations.d.ts index dc8c2f7..f8b65df 100644 --- a/src/declarations.d.ts +++ b/src/declarations.d.ts @@ -1,4 +1,4 @@ declare module '*.module.scss' { const styles: { [className: string]: string }; - export = styles; + export default styles; } diff --git a/src/webparts/modernPromotedLinks/ModernPromotedLinksWebPart.ts b/src/webparts/modernPromotedLinks/ModernPromotedLinksWebPart.ts index 182d5a5..891a962 100644 --- a/src/webparts/modernPromotedLinks/ModernPromotedLinksWebPart.ts +++ b/src/webparts/modernPromotedLinks/ModernPromotedLinksWebPart.ts @@ -15,7 +15,7 @@ import { PromotedLinksDataService } from './PromotedLinksDataService'; import { IPromotedLinkItem, IPromotedLinksListOption } from './PromotedLinkTypes'; import ModernPromotedLinks from './components/ModernPromotedLinks'; import { IModernPromotedLinksProps } from './components/IModernPromotedLinksProps'; -import styles = require('./components/ModernPromotedLinks.module.scss'); +import styles from './components/ModernPromotedLinks.module.scss'; export interface IModernPromotedLinksWebPartProps { listId: string; @@ -31,11 +31,6 @@ export default class ModernPromotedLinksWebPart extends BaseClientSideWebPart { - this.service = new PromotedLinksDataService(this.context); - return super.onInit().then((): Promise => this.loadLists()); - } - public render(): void { const version: number = ++this.requestVersion; if (!this.properties.listId) { this.renderStatus(strings.ConfigureMessage, false); return; } @@ -58,6 +53,11 @@ export default class ModernPromotedLinksWebPart extends BaseClientSideWebPart { + this.service = new PromotedLinksDataService(this.context); + return super.onInit().then((): Promise => this.loadLists()); + } + protected onDispose(): void { this.disposed = true; this.requestVersion++; diff --git a/src/webparts/modernPromotedLinks/PromotedLinksDataService.ts b/src/webparts/modernPromotedLinks/PromotedLinksDataService.ts index 1a37c27..d9ae172 100644 --- a/src/webparts/modernPromotedLinks/PromotedLinksDataService.ts +++ b/src/webparts/modernPromotedLinks/PromotedLinksDataService.ts @@ -34,7 +34,9 @@ export class PromotedLinksDataService { } private get webUrl(): string { return this.context.pageContext.web.absoluteUrl.replace(/\/$/, ''); } - private get headers(): any { return { 'Accept': 'application/json;odata=verbose', 'OData-Version': '3.0' }; } // tslint:disable-line:no-any + private get headers(): any { // tslint:disable-line:no-any + return { 'Accept': 'application/json;odata=verbose', 'OData-Version': '3.0' }; + } private getJson(url: string): Promise { // tslint:disable-line:no-any return this.context.spHttpClient.get(url, SPHttpClient.configurations.v1, { headers: this.headers }) diff --git a/src/webparts/modernPromotedLinks/components/ModernPromotedLinks.tsx b/src/webparts/modernPromotedLinks/components/ModernPromotedLinks.tsx index 004ca81..cd56da1 100644 --- a/src/webparts/modernPromotedLinks/components/ModernPromotedLinks.tsx +++ b/src/webparts/modernPromotedLinks/components/ModernPromotedLinks.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { isDialogLaunch, isNewTabLaunch } from '../PromotedLinkCore'; import { IPromotedLinkItem } from '../PromotedLinkTypes'; -import styles = require('./ModernPromotedLinks.module.scss'); +import styles from './ModernPromotedLinks.module.scss'; import { IModernPromotedLinksProps } from './IModernPromotedLinksProps'; export default class ModernPromotedLinks extends React.Component { @@ -19,17 +19,21 @@ export default class ModernPromotedLinks extends React.Component ): void => this.openDialog(event, item) : undefined}> + onClick={dialog ? (event: React.MouseEvent): void => + this.openDialog(event, item) : undefined}> {!item.imageUrl && } {item.title || item.linkUrl} - {this.props.showDescriptions && item.description && {item.description}} + {this.props.showDescriptions && item.description && + {item.description}} @@ -42,7 +46,7 @@ export default class ModernPromotedLinks extends React.Component