-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9b2fa2
commit 264c560
Showing
5 changed files
with
106 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ export const RenderExample = () => { | |
>` | ||
)}`; | ||
}, | ||
tooltip: 'Tooltip for the employee tags', | ||
}, | ||
], | ||
])} | ||
|
33 changes: 33 additions & 0 deletions
33
server_manager/www/views/server_view/info_tooltip/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {LitElement, css, html} from 'lit'; | ||
import {customElement, property} from 'lit/decorators.js'; | ||
|
||
import '@material/mwc-icon'; | ||
|
||
@customElement('info-tooltip') | ||
export class InformationTooltip extends LitElement { | ||
@property({type: String}) text: string; | ||
|
||
static styles = css` | ||
:host { | ||
--info-tooltip-icon-size: 1.85rem; | ||
--mdc-icon-size: var(--info-tooltip-icon-size); | ||
} | ||
.tooltip-container { | ||
display: flex; | ||
cursor: help; | ||
} | ||
`; | ||
|
||
render() { | ||
return html`<div class="tooltip-container"> | ||
<!-- | ||
TODO: Absolute positioning doesn't work in all contexts, including parents with overflow: hidden and CSS Grid. | ||
In order to style the tooltip text, we need to use the Popover API, which is not supported in the current version | ||
of Electron we ship. Once we upgrade Electron V25, we can then update this tooltip to use the Popover API. | ||
--> | ||
<mwc-icon title=${this.text}>info</mwc-icon> | ||
</div>`; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
server_manager/www/views/server_view/info_tooltip/stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {html} from 'lit'; | ||
import '../info_tooltip'; | ||
|
||
export default { | ||
title: 'Manager/Server View/Info Tooltip', | ||
component: 'info-tooltip', | ||
}; | ||
|
||
export const Basic = () => html` | ||
<info-tooltip text="Tooltip text here"></info-tooltip> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters