|
|
|
@ -1,4 +1,11 @@
|
|
|
|
|
import { DeesElement, html, property, customElement } from '@designestate/dees-element';
|
|
|
|
|
import {
|
|
|
|
|
DeesElement,
|
|
|
|
|
html,
|
|
|
|
|
property,
|
|
|
|
|
customElement,
|
|
|
|
|
cssManager,
|
|
|
|
|
css,
|
|
|
|
|
} from '@designestate/dees-element';
|
|
|
|
|
|
|
|
|
|
import * as domtools from '@designestate/dees-domtools';
|
|
|
|
|
|
|
|
|
@ -21,11 +28,16 @@ import {
|
|
|
|
|
import {
|
|
|
|
|
faBell as faBellSolid,
|
|
|
|
|
faBug as faBugSolid,
|
|
|
|
|
faCaretLeft as faCaretLeftSolid,
|
|
|
|
|
faCircleInfo as faCircleInfoSolid,
|
|
|
|
|
faDesktop as faDesktopSolid,
|
|
|
|
|
faGrip as faGripSolid,
|
|
|
|
|
faMessage as faMessageSolid,
|
|
|
|
|
faRss as faRssSolid,
|
|
|
|
|
faUsers as faUsersSolid,
|
|
|
|
|
faShare as faShareSolid,
|
|
|
|
|
faSun as faSunSolid,
|
|
|
|
|
faGrip as faGripSolid,
|
|
|
|
|
faXmark as faXmarkSolid,
|
|
|
|
|
} from '@fortawesome/free-solid-svg-icons';
|
|
|
|
|
|
|
|
|
|
export const faIcons = {
|
|
|
|
@ -34,16 +46,24 @@ export const faIcons = {
|
|
|
|
|
bellSolid: faBellSolid,
|
|
|
|
|
bug: faBugSolid,
|
|
|
|
|
bugSolid: faBugSolid,
|
|
|
|
|
caretLeft: faCaretLeftSolid,
|
|
|
|
|
caretLeftSolid: faCaretLeftSolid,
|
|
|
|
|
circleinfo: faCircleInfoSolid,
|
|
|
|
|
circleinfoSolid: faCircleInfoSolid,
|
|
|
|
|
desktop: faDesktopSolid,
|
|
|
|
|
desktopSolid: faDesktopSolid,
|
|
|
|
|
grip: faGripSolid,
|
|
|
|
|
gripSolid: faGripSolid,
|
|
|
|
|
message: faMessageRegular,
|
|
|
|
|
messageSolid: faMessageRegular,
|
|
|
|
|
messageSolid: faMessageSolid,
|
|
|
|
|
rss: faRssSolid,
|
|
|
|
|
rssSolid: faRssSolid,
|
|
|
|
|
share: faShareSolid,
|
|
|
|
|
shareSolid: faShareSolid,
|
|
|
|
|
sun: faSunRegular,
|
|
|
|
|
sunSolid: faSunSolid,
|
|
|
|
|
xmark: faXmarkSolid,
|
|
|
|
|
xmarkSolid: faXmarkSolid,
|
|
|
|
|
// brands
|
|
|
|
|
facebook: faFacebook,
|
|
|
|
|
google: faGoogle,
|
|
|
|
@ -66,8 +86,8 @@ declare global {
|
|
|
|
|
export class DeesIcon extends DeesElement {
|
|
|
|
|
public static demo = () => html`
|
|
|
|
|
<dees-icon iconName="visibility"></dees-icon>
|
|
|
|
|
<div style="background: #fff; padding: 10px; font-size: 24px">
|
|
|
|
|
<dees-icon iconFA="message"></dees-icon>
|
|
|
|
|
<div style="background: #fff; padding: 10px; font-size: 30px">
|
|
|
|
|
<dees-icon iconFA="messageSolid"></dees-icon>
|
|
|
|
|
<dees-icon iconFA="sun"></dees-icon>
|
|
|
|
|
<dees-icon iconFA="sunSolid"></dees-icon>
|
|
|
|
|
<dees-icon iconFA="facebook"></dees-icon>
|
|
|
|
@ -78,25 +98,32 @@ export class DeesIcon extends DeesElement {
|
|
|
|
|
public iconFA: keyof typeof faIcons;
|
|
|
|
|
|
|
|
|
|
@property()
|
|
|
|
|
public iconSize: number = 20;
|
|
|
|
|
public iconSize: number;
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
domtools.elementBasic.setup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static styles = [
|
|
|
|
|
cssManager.defaultStyles,
|
|
|
|
|
css`
|
|
|
|
|
:host {
|
|
|
|
|
display: block;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public render() {
|
|
|
|
|
return html`
|
|
|
|
|
${domtools.elementBasic.styles}
|
|
|
|
|
<style>
|
|
|
|
|
:host {
|
|
|
|
|
display: block;
|
|
|
|
|
margin: 0px;
|
|
|
|
|
padding: 0px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
#iconContainer svg {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
display: block;
|
|
|
|
|
height: ${this.iconSize}px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
@ -105,6 +132,9 @@ export class DeesIcon extends DeesElement {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async firstUpdated() {
|
|
|
|
|
if (!this.iconSize) {
|
|
|
|
|
this.iconSize = parseInt(globalThis.getComputedStyle(this).fontSize.replace(/\D/g,''));
|
|
|
|
|
}
|
|
|
|
|
if (this.iconFA) {
|
|
|
|
|
this.shadowRoot.querySelector('#iconContainer').innerHTML = this.iconFA
|
|
|
|
|
? icon(faIcons[this.iconFA]).html[0]
|
|
|
|
|