@panoramax/web-viewer
Version:
Panoramax web viewer for geolocated pictures
67 lines (60 loc) • 1.69 kB
JavaScript
import { LitElement, html, css } from "lit";
import { panel } from "../styles";
/**
* List Group element displays a menu having a list of rapid actions (links, buttons).
*
* Note that you may only want to use basic HTML elements (`a`, `button`) instead of Panoramax ones.
* The list group overrides style, so using `pnx-*` component may conflict on styling.
* @class Panoramax.components.ui.ListGroup
* @element pnx-list-group
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
* @slot `default` Any element you want to add in list.
* @example
* ```html
* <pnx-list-group>
* <a href="https://web.site/">First link</a>
* <button>Second button</button>
* </pnx-list-group>
* ```
*/
export default class ListGroup extends LitElement {
/** @private */
static styles = [ panel, css`
:host ::slotted(*) {
text-decoration: none;
border: none;
border-bottom: 1px solid var(--widget-border-div);
background: none;
display: block;
width: 100%;
color: var(--widget-font);
font-family: var(--font-family);
cursor: pointer;
font-size: 1em;
font-weight: 400;
line-height: 18px;
padding: 5px 10px;
min-width: 150px;
width: 100%;
text-align: left;
box-sizing: border-box;
}
:host ::slotted(*:hover) {
background-color: var(--widget-bg-hover);
}
:host ::slotted(*:first-child) {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
:host ::slotted(*:last-child) {
border: none;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
` ];
/** @private */
render() {
return html`<slot></slot>`;
}
}
customElements.define("pnx-list-group", ListGroup);