align menu

This commit is contained in:
Lone Iversen
2024-06-25 11:15:09 +02:00
parent 19871650cb
commit f2c15e8774
2 changed files with 10 additions and 13 deletions

View File

@@ -13,6 +13,9 @@ export class UmbImageCropperPreviewElement extends LitElement {
@property({ type: String, attribute: false }) @property({ type: String, attribute: false })
src: string = ''; src: string = '';
@property({ type: String })
label?: string;
@property({ attribute: false }) @property({ attribute: false })
get focalPoint() { get focalPoint() {
return this.#focalPoint; return this.#focalPoint;
@@ -140,14 +143,14 @@ export class UmbImageCropperPreviewElement extends LitElement {
render() { render() {
if (!this.crop) { if (!this.crop) {
return nothing; return html`<span id="label">${this.label}</span>`;
} }
return html` return html`
<div id="container"> <div id="container">
<img id="image" src=${this.src} alt="" /> <img id="image" src=${this.src} alt="" />
</div> </div>
<span id="alias">${this.crop.alias}</span> <span id="alias">${this.label ?? this.crop.alias}</span>
<span id="dimensions">${this.crop.width} x ${this.crop.height}</span> <span id="dimensions">${this.crop.width} x ${this.crop.height}</span>
${this.crop.coordinates ${this.crop.coordinates
? html`<span id="user-defined"><umb-localize key="imagecropper_customCrop">User defined</umb-localize></span>` ? html`<span id="user-defined"><umb-localize key="imagecropper_customCrop">User defined</umb-localize></span>`
@@ -178,6 +181,9 @@ export class UmbImageCropperPreviewElement extends LitElement {
max-height: 200px; max-height: 200px;
user-select: none; user-select: none;
} }
#label {
font-weight: bold;
}
#alias { #alias {
font-weight: bold; font-weight: bold;
margin-top: var(--uui-size-space-3); margin-top: var(--uui-size-space-3);

View File

@@ -29,11 +29,10 @@ export class UmbImageCropperEditorFieldElement extends UmbInputImageCropperField
override renderSide() { override renderSide() {
if (!this.value || !this.crops) return; if (!this.value || !this.crops) return;
return html` <uui-menu-item return html` <umb-image-cropper-preview
id="reset-current-crop"
@click=${this.#resetCurrentCrop} @click=${this.#resetCurrentCrop}
?active=${!this.currentCrop} ?active=${!this.currentCrop}
label=${this.localize.term('general_media')}></uui-menu-item> .label=${this.localize.term('general_media')}></umb-image-cropper-preview>
${repeat( ${repeat(
this.crops, this.crops,
@@ -75,14 +74,6 @@ export class UmbImageCropperEditorFieldElement extends UmbInputImageCropperField
padding-right: var(--uui-size-3); padding-right: var(--uui-size-3);
} }
#reset-current-crop {
--uui-menu-item-flat-structure: 1;
--uui-menu-item-border-radius: var(--uui-border-radius);
border-radius: var(--uui-border-radius);
width: 100%;
background-color: var(--uui-color-surface);
}
slot[name='actions'] { slot[name='actions'] {
display: block; display: block;
flex: 1; flex: 1;