Skip to content

Commit c432f5a

Browse files
authored
load more button component and styling (#19622)
* localization * tree-load-more-button component * implement * ability to hide block actions * Revert "ability to hide block actions" This reverts commit bf8222f.
1 parent 9cb0557 commit c432f5a

File tree

7 files changed

+41
-2
lines changed

7 files changed

+41
-2
lines changed

src/Umbraco.Web.UI.Client/src/assets/lang/da.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default {
6565
editContent: 'Rediger indhold',
6666
chooseWhereToImport: 'Vælg hvor du vil importere',
6767
viewActionsFor: (name) => (name ? `Se handlinger for '${name}'` : 'Se handlinger'),
68+
loadMore: 'Indlæs flere',
6869
},
6970
actionCategories: {
7071
content: 'Indhold',

src/Umbraco.Web.UI.Client/src/assets/lang/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export default {
7373
wasDeleted: 'was deleted',
7474
wasMovedTo: 'was moved to',
7575
viewActionsFor: (name) => (name ? `View actions for '${name}'` : 'View actions'),
76+
loadMore: 'Load more',
7677
},
7778
actionCategories: {
7879
content: 'Content',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './tree-load-more-button.element.js';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { css, customElement, html } from '@umbraco-cms/backoffice/external/lit';
2+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
3+
4+
@customElement('umb-tree-load-more-button')
5+
export class UmbTreeLoadMoreButtonElement extends UmbLitElement {
6+
override render() {
7+
return html`<uui-button
8+
data-mark="tree:load-more"
9+
id="load-more"
10+
look="secondary"
11+
.label=${this.localize.term('actions_loadMore')}></uui-button>`;
12+
}
13+
14+
static override readonly styles = css`
15+
:host {
16+
position: relative;
17+
display: block;
18+
padding-left: var(--uui-size-space-3);
19+
margin-right: var(--uui-size-space-2);
20+
margin-bottom: var(--uui-size-layout-2);
21+
margin-left: calc(var(--uui-menu-item-indent, 0) * var(--uui-size-4));
22+
}
23+
uui-button {
24+
width: 100%;
25+
height: var(--uui-size---uui-size-layout-3);
26+
--uui-box-border-radius: calc(var(--uui-border-radius) * 2);
27+
}
28+
`;
29+
}
30+
31+
declare global {
32+
interface HTMLElementTagNameMap {
33+
'umb-tree-load-more-button': UmbTreeLoadMoreButtonElement;
34+
}
35+
}

src/Umbraco.Web.UI.Client/src/packages/core/tree/default/default-tree.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class UmbDefaultTreeElement extends UmbLitElement {
170170
return nothing;
171171
}
172172

173-
return html` <uui-button id="load-more" @click=${this.#onLoadMoreClick} label="Load more"></uui-button> `;
173+
return html` <umb-tree-load-more-button @click=${this.#onLoadMoreClick}></umb-tree-load-more-button> `;
174174
}
175175

176176
static override styles = css`

src/Umbraco.Web.UI.Client/src/packages/core/tree/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './components/index.js';
12
export * from './constants.js';
23
export * from './data/index.js';
34
export * from './default/index.js';

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-base/tree-item-element-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,6 @@ export abstract class UmbTreeItemElementBase<
220220
return nothing;
221221
}
222222

223-
return html` <uui-button @click=${this.#onLoadMoreClick} label="Load more"></uui-button> `;
223+
return html` <umb-tree-load-more-button @click=${this.#onLoadMoreClick}></umb-tree-load-more-button> `;
224224
}
225225
}

0 commit comments

Comments
 (0)