Skip to content

Commit 45b87c2

Browse files
nielslyngsoeCopilotandr317c
authored
Content Type Designer: fix style and localization (#20073)
* fix style and localization * Update src/Umbraco.Web.UI.Client/src/packages/content/content-type/workspace/views/design/content-type-design-editor.element.ts Co-authored-by: Copilot <[email protected]> * fix class name as well * add data-marks * Updated package version to include test fixes for tab name --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Andreas Zerbst <[email protected]>
1 parent f06da1c commit 45b87c2

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

src/Umbraco.Web.UI.Client/src/packages/content/content-type/workspace/views/design/content-type-design-editor.element.ts

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
475475
// TODO: Localize this:
476476
if (this._sortModeActive) return;
477477
return html`
478-
<uui-button id="add-tab" @click="${this.#addTab}" label="Add tab">
478+
<uui-button id="add-tab" data-mark="add-tab-button" @click="${this.#addTab}" label="Add tab">
479479
<uui-icon name="icon-add"></uui-icon>
480480
Add tab
481481
</uui-button>
@@ -492,6 +492,7 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
492492
${this._compositionRepositoryAlias
493493
? html`
494494
<uui-button
495+
data-mark="edit-compositions"
495496
look="outline"
496497
label=${this.localize.term('contentTypeEditor_compositions')}
497498
compact
@@ -501,7 +502,12 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
501502
</uui-button>
502503
`
503504
: ''}
504-
<uui-button look="outline" label=${sortButtonText} compact @click=${this.#toggleSortMode}>
505+
<uui-button
506+
data-mark="toggle-sort-mode"
507+
look="outline"
508+
label=${sortButtonText}
509+
compact
510+
@click=${this.#toggleSortMode}>
505511
<uui-icon name="icon-height"></uui-icon>
506512
${sortButtonText}
507513
</uui-button>
@@ -571,26 +577,28 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
571577
const tabName = hasTabName ? tab.name : 'Unnamed';
572578
const tabId = tab.ownerId ?? tab.ids[0];
573579
if (this._sortModeActive) {
574-
return html`<div class="tab">
580+
return html`<div class="tab-inner">
575581
${ownedTab
576-
? html`<uui-icon name="icon-grip" class="drag-${tabId}"> </uui-icon>${tabName}
582+
? html`<uui-icon name="icon-grip" class="drag-${tabId}"> </uui-icon>${this.localize.string(tabName)}
577583
<uui-input
584+
data-mark="tab:sort-input"
578585
label="sort order"
579586
type="number"
580587
value=${ifDefined(tab.sortOrder)}
581588
style="width:50px"
582589
@change=${(e: UUIInputEvent) => this.#changeOrderNumber(tab, e)}></uui-input>`
583-
: html`<uui-icon name="icon-merge"></uui-icon>${tab.name!}`}
590+
: html`<uui-icon name="icon-merge"></uui-icon>${this.localize.string(tabName)}`}
584591
</div>`;
585592
}
586593

587594
if (tabActive && ownedTab) {
588-
return html`<div class="tab">
595+
return html`<div class="tab-inner">
589596
<uui-input
597+
data-mark="tab:name-input"
590598
id="input"
591599
look="placeholder"
592600
placeholder="Unnamed"
593-
label=${tab.name!}
601+
label=${this.localize.term('settings_tabname')}
594602
value="${tab.name!}"
595603
auto-width
596604
minlength="1"
@@ -604,12 +612,13 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
604612

605613
if (ownedTab) {
606614
return html`<div class="not-active">
607-
<span class=${hasTabName ? '' : 'invaild'}>${hasTabName ? tab.name : 'Unnamed'}</span> ${this.renderDeleteFor(
608-
tab,
609-
)}
615+
<span class=${hasTabName ? '' : 'invalid'}>${hasTabName ? this.localize.string(tabName) : 'Unnamed'}</span>
616+
${this.renderDeleteFor(tab)}
610617
</div>`;
611618
} else {
612-
return html`<div class="not-active"><uui-icon name="icon-merge"></uui-icon>${tab.name!}</div>`;
619+
return html`<div class="not-active">
620+
<uui-icon name="icon-merge"></uui-icon>${this.localize.string(tabName)}
621+
</div>`;
613622
}
614623
}
615624

@@ -621,6 +630,7 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
621630

622631
renderDeleteFor(tab: UmbPropertyTypeContainerMergedModel) {
623632
return html`<uui-button
633+
data-mark="tab:delete"
624634
label=${this.localize.term('actions_remove')}
625635
class="trash"
626636
slot="append"
@@ -708,6 +718,14 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
708718
background-color: var(--uui-color-surface);
709719
}
710720
721+
.tab-inner {
722+
display: inline-flex;
723+
align-items: center;
724+
justify-content: center;
725+
gap: var(--uui-size-space-2);
726+
margin-right: calc(var(--uui-size-space-3) * -1);
727+
}
728+
711729
.not-active uui-button {
712730
pointer-events: auto;
713731
}
@@ -721,7 +739,7 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
721739
gap: var(--uui-size-space-3);
722740
}
723741
724-
.invaild {
742+
.invalid {
725743
color: var(--uui-color-danger, var(--uui-color-invalid));
726744
}
727745

tests/Umbraco.Tests.AcceptanceTest/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Umbraco.Tests.AcceptanceTest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"dependencies": {
2424
"@umbraco/json-models-builders": "^2.0.37",
25-
"@umbraco/playwright-testhelpers": "^16.0.41",
25+
"@umbraco/playwright-testhelpers": "^16.0.42",
2626
"camelize": "^1.0.0",
2727
"dotenv": "^16.3.1",
2828
"node-fetch": "^2.6.7"

0 commit comments

Comments
 (0)