-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: changed switch component to be a FormsModule independen switchi…
…ng component
- Loading branch information
Showing
8 changed files
with
43 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
src/app/shared/components/common/switch/switch.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
<span class="custom-control custom-switch d-inline"> | ||
<input | ||
[formControl]="activeSwitch" | ||
type="checkbox" | ||
role="switch" | ||
class="custom-control-input" | ||
autocomplete="off" | ||
[id]="id" | ||
[ngModel]="active" | ||
(ngModelChange)="switchActive(id, $event)" | ||
[checked]="active" | ||
[disabled]="disabled" | ||
(click)="toggleState()" | ||
/> | ||
<label class="custom-control-label" [for]="id">{{ label }}</label> | ||
<label class="custom-control-label" [for]="id">{{ activeState ? labelActive : labelInactive }}</label> | ||
</span> |
18 changes: 13 additions & 5 deletions
18
src/app/shared/components/common/switch/switch.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
@import 'variables'; | ||
|
||
.custom-control-input ~ .custom-control-label::before { | ||
background-color: #999; | ||
border-color: #999; | ||
background-color: $text-color-quaternary; | ||
border-color: $text-color-quaternary; | ||
} | ||
|
||
.custom-control-input:disabled ~ .custom-control-label::before { | ||
background-color: $text-color-quinary; | ||
} | ||
|
||
.custom-control-input:checked ~ .custom-control-label::before { | ||
background-color: $color-corporate; | ||
border-color: $color-corporate; | ||
background-color: $CORPORATE-PRIMARY; | ||
border-color: $CORPORATE-PRIMARY; | ||
} | ||
|
||
.custom-control-input:checked:disabled ~ .custom-control-label::before { | ||
background-color: $CORPORATE-LIGHT; | ||
} | ||
|
||
.custom-switch .custom-control-label::after { | ||
background-color: #fff; | ||
background-color: $white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters