Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/layout issues #1037

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import { UMB_BACKOFFICE_CONTEXT_TOKEN } from '../backoffice.context.js';
import type { UmbBackofficeContext } from '../backoffice.context.js';
import { css, CSSResultGroup, html, when, customElement, state, repeat } from '@umbraco-cms/backoffice/external/lit';

Check warning on line 3 in src/apps/backoffice/components/backoffice-header-sections.element.ts

View workflow job for this annotation

GitHub Actions / build (20)

'when' is defined but never used
import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry';
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
import { UmbExtensionManifestInitializer } from '@umbraco-cms/backoffice/extension-api';

@customElement('umb-backoffice-header-sections')
export class UmbBackofficeHeaderSectionsElement extends UmbLitElement {
@state()
private _open = false;

@state()
private _sections: Array<UmbExtensionManifestInitializer<ManifestSection>> = [];

@state()
private _extraSections: Array<ManifestSection> = [];

@state()
private _currentSectionAlias = '';

Expand All @@ -31,18 +25,6 @@
});
}

private _handleMore(e: MouseEvent) {
e.stopPropagation();
this._open = !this._open;
}

private _handleLabelClick() {
const moreTab = this.shadowRoot?.getElementById('moreTab');
moreTab?.setAttribute('active', 'true');

this._open = false;
}

private _observeSections() {
if (!this._backofficeContext) return;

Expand Down Expand Up @@ -72,64 +54,30 @@
?active="${this._currentSectionAlias === section.alias}"
href="${`section/${section.manifest?.meta.pathname}`}"
label="${section.manifest?.meta.label ?? section.manifest?.name ?? ''}"></uui-tab>
`
`,
)}
${this._renderExtraSections()}
</uui-tab-group>
`;
}

private _renderExtraSections() {
return when(
this._extraSections.length > 0,
() => html`
<uui-tab id="moreTab">
<uui-popover .open=${this._open} placement="bottom-start" @close="${() => (this._open = false)}">
<uui-button slot="trigger" look="primary" label="More" @click="${this._handleMore}" compact>
<uui-symbol-more></uui-symbol-more>
</uui-button>

<div slot="popover" id="dropdown">
${this._extraSections.map(
(section) => html`
<uui-menu-item
?active="${this._currentSectionAlias === section.alias}"
label="${section.meta.label || section.name}"
@click-label="${this._handleLabelClick}"></uui-menu-item>
`
)}
</div>
</uui-popover>
</uui-tab>
`
);
}

render() {
return html` ${this._renderSections()} `;
}

static styles: CSSResultGroup = [
css`
:host {
display: contents;
}
#tabs {
color: var(--uui-color-header-contrast);
height: 60px;
flex-basis: 100%;
font-size: 16px;
--uui-tab-text: var(--uui-color-header-contrast);
--uui-tab-text-hover: var(--uui-color-header-contrast-emphasis);
--uui-tab-text-active: var(--uui-color-header-contrast-emphasis);
--uui-tab-background: var(--uui-color-header-background);
}

#dropdown {
background-color: white;
border-radius: var(--uui-border-radius);
width: 100%;
height: 100%;
box-sizing: border-box;
box-shadow: var(--uui-shadow-depth-3);
min-width: 200px;
color: black; /* Change to variable */
background-color: var(--uui-color-header-background);
--uui-tab-group-dropdown-background: var(--uui-color-header-surface);
}
`,
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UmbTextStyles } from "@umbraco-cms/backoffice/style";
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import {
css,
html,
Expand Down Expand Up @@ -191,6 +191,7 @@ export class UmbBodyLayoutElement extends LitElement {
height: 100%;
align-items: center;
box-sizing: border-box;
min-width: 0;
}

#navigation-slot,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UmbTextStyles } from "@umbraco-cms/backoffice/style";
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { css, html, LitElement, customElement } from '@umbraco-cms/backoffice/external/lit';

@customElement('umb-section-main')
Expand All @@ -17,6 +17,7 @@ export class UmbSectionMainElement extends LitElement {
:host {
flex: 1 1 auto;
height: 100%;
min-width: 0;
}

main {
Expand Down
Loading