fonteva-design-guide
Version:
## Dev, Build and Test
60 lines (48 loc) • 1.51 kB
JavaScript
import { LightningElement, track, api } from 'lwc';
import PFM_Base from 'c/pfmBase';
export default class Tile extends PFM_Base {
type;
classes;
background;
hasFooter = true;
fullHeight;
// danger, success, brand, shade, shade-dark, blue-dark
get theme() {
return this.background;
}
set theme(value) {
this.background = value;
}
get padding() {
return super.paddingStr;
}
set padding(value) {
super.paddingStr = value;
}
get margin() {
return super.marginStr;
}
set margin(value) {
super.marginStr = value;
}
connectedCallback() {
super.connectedCallback('pfm-tile');
let valType = this.type,
valHeight = this.fullHeight,
valBackground = this.background;
let type, height, background;
type = valType ? ' ' + valType : '';
height = valHeight ? ' pfm-tile_height-full' : '';
background = valBackground ? ' pfm-tile-theme_' + valBackground : ''; // brand, danger, success, shade, shade-dark
this.classes = this.classStr + type + background + height;
}
renderedCallback() {
const footer = this.querySelectorAll('span[slot="footer"]');
if (footer.length === 0) {
this.hasFooter = false;
}
super.renderedCallback('pfm-tile');
}
}