From 6081b9ddf9b2aa1fa32a507f4adb7576d64ac289 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Mon, 15 Jul 2024 13:19:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Adjust=20the=20height=20of=20the?= =?UTF-8?q?=20Dummy=20preview-button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dummy button now better aligns with the button settings --- .../js/modules/Preview/DummyPreviewButton.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/ppcp-button/resources/js/modules/Preview/DummyPreviewButton.js b/modules/ppcp-button/resources/js/modules/Preview/DummyPreviewButton.js index ed5f3bee7..c780d188d 100644 --- a/modules/ppcp-button/resources/js/modules/Preview/DummyPreviewButton.js +++ b/modules/ppcp-button/resources/js/modules/Preview/DummyPreviewButton.js @@ -26,7 +26,7 @@ export default class DummyPreviewButton extends PreviewButton { this.#innerEl = document.createElement( 'div' ); this.#innerEl.innerHTML = `
${ this.label }
`; - this._applyShape( this.ppcpConfig?.button?.style?.shape ); + this._applyStyles( this.ppcpConfig?.button?.style ); this.domWrapper.appendChild( this.#innerEl ); } @@ -34,15 +34,19 @@ export default class DummyPreviewButton extends PreviewButton { /** * Applies the button shape (rect/pill) to the dummy button * - * @param {string|null} shape + * @param {{shape: string, height: number|null}} style * @private */ - _applyShape( shape = 'rect' ) { + _applyStyles( style ) { this.domWrapper.classList.remove( 'ppcp-button-pill', 'ppcp-button-rect' ); - this.domWrapper.classList.add( `ppcp-button-${ shape }` ); + this.domWrapper.classList.add( `ppcp-button-${ style.shape }` ); + + if ( style.height ) { + this.domWrapper.style.height = `${ style.height }px`; + } } }