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

Add overlay UI element #633

Closed
wants to merge 11 commits into from
18 changes: 17 additions & 1 deletion packages/widgets/src/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,8 @@ export namespace TabBar {
return h.li(
{ id, key, className, title, style, dataset, ...aria },
this.renderIcon(data),
this.renderLabel(data)
this.renderLabel(data),
this.renderOverlay(dataset)
);
}
}
Expand Down Expand Up @@ -1755,6 +1756,21 @@ export namespace TabBar {
return h.div({ className: 'lm-TabBar-tabCloseIcon' });
}

/**
* Add a className to display/hide the ovleray on a tab.
*
* @param dataset - The data to identify a launcher.
*
* @returns A virtual element representing the tab overlay.
*/
renderOverlay(dataset: ElementDataset): VirtualElement {
if (dataset.id?.toLowerCase().includes('launcher')) {
return h.div({ className: 'lm-TabBar-UI-Overlay.lm-mod-hidden' });
} else {
return h.div({ className: 'lm-TabBar-UI-Overlay' });
}
}

/**
* Create a unique render key for the tab.
*
Expand Down
18 changes: 18 additions & 0 deletions packages/widgets/style/tabbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,21 @@
box-sizing: border-box;
background: inherit;
}

.lm-TabBar-UI-Overlay {
position: absolute;
top: 67%;
left: 45%;
width: 47%;
height: 32%;
border-radius: 25%;
z-index: inherit;
text-align: center;
color: rgb(255, 255, 255);
background: rgb(51, 51, 51);
visibility: hidden;
}

.lm-TabBar-UI-Overlay.lm-mod-hidden {
display: none !important;
}
1 change: 1 addition & 0 deletions review/api/widgets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@ export namespace TabBar {
renderCloseIcon(data: IRenderData<any>): VirtualElement;
renderIcon(data: IRenderData<any>): VirtualElement;
renderLabel(data: IRenderData<any>): VirtualElement;
renderOverlay(dataset: ElementDataset): VirtualElement;
renderTab(data: IRenderData<any>): VirtualElement;
}
const defaultRenderer: Renderer;
Expand Down
Loading