Skip to content
Snippets Groups Projects
frame.component.ts 1.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • rhenck's avatar
    rhenck committed
    import { Component, Input } from '@angular/core';
    
    rhenck's avatar
    rhenck committed
    import { ElementComponent } from '../../directives/element-component.directive';
    
    import { FrameElement } from '../../interfaces/elements';
    
    rhenck's avatar
    rhenck committed
    
    @Component({
    
      selector: 'aspect-frame',
    
    rhenck's avatar
    rhenck committed
      template: `
    
        <div [class.center-content]="elementModel.positionProps.dynamicPositioning &&
                                     elementModel.positionProps.fixedSize"
             [style.width]="elementModel.positionProps.fixedSize ?
                elementModel.width + 'px' :
    
    rhenck's avatar
    rhenck committed
                'calc(100% - ' + (elementModel.styles.borderWidth * 2) + 'px)'"
    
             [style.height]="elementModel.positionProps.fixedSize ?
                elementModel.height + 'px' :
    
    rhenck's avatar
    rhenck committed
                'calc(100% - ' + (elementModel.styles.borderWidth * 2) + 'px)'"
             [style.border-style]="elementModel.styles.borderStyle"
             [style.border-width.px]="elementModel.styles.borderWidth"
             [style.border-color]="elementModel.styles.borderColor"
             [style.border-radius.px]="elementModel.styles.borderRadius"
             [style.background-color]="elementModel.styles.backgroundColor">
    
    rhenck's avatar
    rhenck committed
      </div>
      `
    })
    
    rhenck's avatar
    rhenck committed
    export class FrameComponent extends ElementComponent {
    
    rhenck's avatar
    rhenck committed
      @Input() elementModel!: FrameElement;
    }