Skip to content
Snippets Groups Projects
Commit 3117716e authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Replace next/prev button labels in the PDF preview with icons

See #25
parent 07c39a06
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ import {classMap} from 'lit-html/directives/class-map.js'; ...@@ -4,7 +4,7 @@ import {classMap} from 'lit-html/directives/class-map.js';
import {live} from 'lit-html/directives/live.js'; import {live} from 'lit-html/directives/live.js';
import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import VPULitElement from 'vpu-common/vpu-lit-element'; import VPULitElement from 'vpu-common/vpu-lit-element';
import {MiniSpinner} from 'vpu-common'; import {MiniSpinner, Icon} from 'vpu-common';
import * as commonUtils from "vpu-common/utils"; import * as commonUtils from "vpu-common/utils";
import * as commonStyles from 'vpu-common/styles'; import * as commonStyles from 'vpu-common/styles';
import pdfjs from 'pdfjs-dist'; import pdfjs from 'pdfjs-dist';
...@@ -41,6 +41,7 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -41,6 +41,7 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
static get scopedElements() { static get scopedElements() {
return { return {
'vpu-mini-spinner': MiniSpinner, 'vpu-mini-spinner': MiniSpinner,
'vpu-icon': Icon,
}; };
} }
...@@ -497,11 +498,15 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -497,11 +498,15 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
<button class="button" <button class="button"
title="${i18n.t('pdf-preview.first-page')}" title="${i18n.t('pdf-preview.first-page')}"
@click="${async () => { await this.showPage(1); } }" @click="${async () => { await this.showPage(1); } }"
?disabled="${this.isPageRenderingInProgress || this.currentPage === 1}">${i18n.t('pdf-preview.first')}</button> ?disabled="${this.isPageRenderingInProgress || this.currentPage === 1}">
<vpu-icon name="angle-double-left"></vpu-icon>
</button>
<button class="button" <button class="button"
title="${i18n.t('pdf-preview.previous-page')}" title="${i18n.t('pdf-preview.previous-page')}"
@click="${async () => { if (this.currentPage > 1) await this.showPage(--this.currentPage); } }" @click="${async () => { if (this.currentPage > 1) await this.showPage(--this.currentPage); } }"
?disabled="${this.isPageRenderingInProgress || this.currentPage === 1}">${i18n.t('pdf-preview.previous')}</button> ?disabled="${this.isPageRenderingInProgress || this.currentPage === 1}">
<vpu-icon name="chevron-left"></vpu-icon>
</button>
<input type="number" <input type="number"
min="1" min="1"
max="${this.totalPages}" max="${this.totalPages}"
...@@ -511,11 +516,15 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -511,11 +516,15 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
<button class="button" <button class="button"
title="${i18n.t('pdf-preview.next-page')}" title="${i18n.t('pdf-preview.next-page')}"
@click="${async () => { if (this.currentPage < this.totalPages) await this.showPage(++this.currentPage); } }" @click="${async () => { if (this.currentPage < this.totalPages) await this.showPage(++this.currentPage); } }"
?disabled="${this.isPageRenderingInProgress || this.currentPage === this.totalPages}">${i18n.t('pdf-preview.next')}</button> ?disabled="${this.isPageRenderingInProgress || this.currentPage === this.totalPages}">
<vpu-icon name="chevron-right"></vpu-icon>
</button>
<button class="button" <button class="button"
title="${i18n.t('pdf-preview.last-page')}" title="${i18n.t('pdf-preview.last-page')}"
@click="${async () => { await this.showPage(this.totalPages); } }" @click="${async () => { await this.showPage(this.totalPages); } }"
?disabled="${this.isPageRenderingInProgress || this.currentPage === this.totalPages}">${i18n.t('pdf-preview.last')}</button> ?disabled="${this.isPageRenderingInProgress || this.currentPage === this.totalPages}">
<vpu-icon name="angle-double-right"></vpu-icon>
</button>
<button class="button ${classMap({hidden: !this.isShowPlacement || isRotationHidden})}" <button class="button ${classMap({hidden: !this.isShowPlacement || isRotationHidden})}"
title="${i18n.t('pdf-preview.rotate-signature')}" title="${i18n.t('pdf-preview.rotate-signature')}"
@click="${() => { this.rotateSignature(); } }" @click="${() => { this.rotateSignature(); } }"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment