Skip to content
Snippets Groups Projects
marking-button.component.ts 983 B
Newer Older
  • Learn to ignore specific revisions
  • import {
      Component, EventEmitter, Input, Output
    } from '@angular/core';
    
    @Component({
      selector: 'app-marking-button',
      template: `
        <button type="button"
                class="marking-button"
    
                mat-mini-fab
                [style.background-color]="color"
    
                (click)="selected = !selected; selectedChanged.emit({ selected, mode, color })">
    
          <mat-icon *ngIf="mode === 'mark'">border_color</mat-icon>
          <mat-icon *ngIf="mode === 'delete'" svgIcon="rubber-black"></mat-icon>
        </button>`,
      styles: [
        '.marking-button {color: #333; margin-left: 5px; margin-top: 2px}',
        '.selected {outline: 2px solid black}']
    })
    export class MarkingButtonComponent {
      @Input() selected!: boolean;
      @Input() color!: string;
      @Input() mode!: 'mark' | 'delete';
      @Input() element!: HTMLElement;
    
      @Output() selectedChanged = new EventEmitter<{
    
        selected: boolean,
        mode: 'mark' | 'delete',
        color: string,
      }>();
    }