Project

General

Profile

1
import {Component, EventEmitter, Input, OnInit, Output,} from '@angular/core';
2

    
3

    
4
@Component({
5
  selector: 'color',
6
  template: `
7
    <div [class]="(addMargin?'uk-margin-small-top':'') + ' colorPicker'">
8
      <div class="uk-grid uk-flex uk-flex-middle uk-remove-margin">
9
        <div class="uk-width-2-3"> {{label}}:</div>
10
        <div class="uk-width-1-3 uk-padding-remove-left">
11
          <input class="uk-margin-small-left uk-width-small "  color-picker [colorPicker]="color"   [style.background]="color"
12
                 (colorPickerChange)="color=$event; colorChanged();"/>
13
        </div>
14
      </div>
15
    </div>
16
  `
17
})
18

    
19
export class ColorComponent implements OnInit {
20
  @Input() color = 'white';
21
  @Input() label = 'Color';
22
  @Input() addMargin: boolean = false;
23
  @Output() colorChange = new EventEmitter();
24

    
25

    
26
  constructor() {
27
  }
28

    
29

    
30
  ngOnInit() {
31
  }
32

    
33
  colorChanged() {
34
    this.colorChange.emit(this.color);
35
  }
36

    
37

    
38
}
(2-2/7)