import { Component, Input, OnChanges } from '@angular/core'; import { Portlet } from "./portlet"; import { StyleLoaderService } from "../../library/style-loader.service"; export type RibbonPositions = "top-left" | "top-right" | "bottom-left" | "bottom-right"; @Component({ selector: 'rd-portlet-ribbon', template: `
{{text}}
{{text}}
` }) export class PortletRibbon extends Portlet implements OnChanges { constructor(private style: StyleLoaderService) { super(); this.style.load(['./assets/css/portletRibbon.css']); } @Input("rd-position") position: RibbonPositions = "top-left"; bodyStyle: object = {}; ngOnChanges(changes) { super.ngOnChanges(changes); if (changes.position) { this.bodyStyle = { "margin-left": this.position.includes("left") ? "100px" : "0", "margin-right": this.position.includes("right") ? "100px" : "0" } } } }