🐛 Fix general preview button shape

This commit is contained in:
Philipp Stracker 2024-07-15 13:16:08 +02:00
parent c780b025a3
commit 7f9cbd6f58
No known key found for this signature in database
3 changed files with 24 additions and 3 deletions

View file

@ -26,6 +26,23 @@ export default class DummyPreviewButton extends PreviewButton {
this.#innerEl = document.createElement( 'div' );
this.#innerEl.innerHTML = `<div class="reason">${ this.label }</div>`;
this._applyShape( this.ppcpConfig?.button?.style?.shape );
this.domWrapper.appendChild( this.#innerEl );
}
/**
* Applies the button shape (rect/pill) to the dummy button
*
* @param {string|null} shape
* @private
*/
_applyShape( shape = 'rect' ) {
this.domWrapper.classList.remove(
'ppcp-button-pill',
'ppcp-button-rect'
);
this.domWrapper.classList.add( `ppcp-button-${ shape }` );
}
}