From bbe9e0bb4f756a377e8f286f99d1fa0e8a16b861 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 8 Jan 2023 12:20:14 +0100 Subject: [PATCH] [DEV] add a generic checkbox --- .../common/component/checkbox/checkbox.html | 7 +++++ .../common/component/checkbox/checkbox.less | 6 ++++ .../src/common/component/checkbox/checkbox.ts | 29 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 front/src/common/component/checkbox/checkbox.html create mode 100644 front/src/common/component/checkbox/checkbox.less create mode 100644 front/src/common/component/checkbox/checkbox.ts diff --git a/front/src/common/component/checkbox/checkbox.html b/front/src/common/component/checkbox/checkbox.html new file mode 100644 index 0000000..c0b63f3 --- /dev/null +++ b/front/src/common/component/checkbox/checkbox.html @@ -0,0 +1,7 @@ +
+ + {{comment}} +
diff --git a/front/src/common/component/checkbox/checkbox.less b/front/src/common/component/checkbox/checkbox.less new file mode 100644 index 0000000..f9efe12 --- /dev/null +++ b/front/src/common/component/checkbox/checkbox.less @@ -0,0 +1,6 @@ + +.elem-checkbox { + font-size: 18px; + font-weight: bold; + margin: 0 10px 0 10px; +} \ No newline at end of file diff --git a/front/src/common/component/checkbox/checkbox.ts b/front/src/common/component/checkbox/checkbox.ts new file mode 100644 index 0000000..0877516 --- /dev/null +++ b/front/src/common/component/checkbox/checkbox.ts @@ -0,0 +1,29 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2018, Edouard DUPIN, all right reserved + * @license PROPRIETARY (see license file) + */ +import { Component, EventEmitter, Input, Output } from '@angular/core'; + +@Component({ + selector: 'app-checkbox', + templateUrl: 'checkbox.html', + styleUrls: ['checkbox.less'], +}) +export class CheckboxComponent { + /// Checkbox value + @Input() value: boolean = false; + /// Description of the checkbox + @Input() comment: string = ""; + /// event when change the value of the password + @Output() changeValue: EventEmitter = new EventEmitter(); + + /** + * When input value change, need update the display and change the internal value. + * @param newValue New value set on the password + */ + onChange(newValue: boolean): void { + this.value = newValue; + this.changeValue.emit(this.value); + } +}