From 3bf4390465bb359ee94c7e12006e3d8954ca2ad4 Mon Sep 17 00:00:00 2001 From: Natanael Date: Fri, 19 Jan 2018 12:13:54 -0200 Subject: [PATCH 1/2] I added new "mini" size --- README.md | 1 + src/ui-switch.component.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 57248af..78fd0a3 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ export class AppModule { > default: medium ```html + // NEW ``` diff --git a/src/ui-switch.component.ts b/src/ui-switch.component.ts index 32a11c5..1e9e738 100644 --- a/src/ui-switch.component.ts +++ b/src/ui-switch.component.ts @@ -16,6 +16,7 @@ const UI_SWITCH_CONTROL_VALUE_ACCESSOR: any = { [class.switch-large]="size === 'large'" [class.switch-medium]="size === 'medium'" [class.switch-small]="size === 'small'" + [class.switch-mini]="size === 'mini'" [style.background-color]="getColor()" [style.border-color]="getColor('borderColor')" > @@ -82,6 +83,17 @@ const UI_SWITCH_CONTROL_VALUE_ACCESSOR: any = { height: 20px; } + .switch-mini { + width: 25px; + height: 13px; + border-radius: 13px; + } + + .switch-mini small { + width: 13px; + height: 13px; + } + .checked { background: rgb(100, 189, 99); border-color: rgb(100, 189, 99); @@ -99,6 +111,10 @@ const UI_SWITCH_CONTROL_VALUE_ACCESSOR: any = { left: 13px; } + .switch-mini.checked small { + left: 12px; + } + .disabled { opacity: .50; cursor: not-allowed; From ea382f2bb9c2c9fc3e2e83d7377e704180153e36 Mon Sep 17 00:00:00 2001 From: Natanael Date: Sat, 27 Jan 2018 21:40:35 -0200 Subject: [PATCH 2/2] fix the function getColor(flag) --- src/ui-switch.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui-switch.component.ts b/src/ui-switch.component.ts index 1e9e738..1f0ee47 100644 --- a/src/ui-switch.component.ts +++ b/src/ui-switch.component.ts @@ -164,7 +164,7 @@ export class UiSwitchComponent implements ControlValueAccessor { defaultBgColor: string = '#fff'; defaultBoColor: string = '#dfdfdf'; - getColor(flag) { + getColor(flag?) { if (flag === 'borderColor') return this.defaultBoColor; if (flag === 'switchColor') { if (this.reverse) return !this.checked ? this.switchColor : this.switchOffColor || this.switchColor;