-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
toogle input changes accross the app
- Loading branch information
1 parent
1e0eb24
commit cf85ef5
Showing
8 changed files
with
83 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div [formGroup]="form"> | ||
<p-inputSwitch [formControlName]="formControllerName" [disabled]="isDisabled"></p-inputSwitch> | ||
<p-inputSwitch [formControlName]="formControllerName" [disabled]="isDisabled" [tooltipPosition]="'top'" [pTooltip]="toolTipText" (onChange)="onToggleChange()" (click)="onToggleClick()"></p-inputSwitch> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.p-inputswitch { | ||
@apply | ||
tw-h-20-px tw-w-50-px #{!important}; | ||
|
||
&.p-focus .p-inputswitch-slider { | ||
@apply tw-shadow-none #{!important}; | ||
} | ||
|
||
.p-inputswitch-slider { | ||
@apply | ||
tw-bg-form-switch-bg tw-w-toggle-width tw-h-toggle-height #{!important}; | ||
&:before { | ||
@apply | ||
tw-mt-[-0.425rem] tw-w-14-px tw-h-14-px #{!important}; | ||
} | ||
} | ||
|
||
&.p-inputswitch-checked .p-inputswitch-slider { | ||
@apply | ||
tw-bg-mandatory-field-color tw-w-toggle-width tw-h-toggle-height #{!important}; | ||
&:before { | ||
@apply | ||
tw-translate-x-toggle-circle-translate #{!important}; | ||
} | ||
&::after { | ||
@apply | ||
tw-content-toggle-text-yes tw-flex tw-justify-center tw-items-center tw-absolute tw-text-12-px tw-text-white tw-font-500 tw-left-8-px tw-bottom-0 #{!important}; | ||
} | ||
} | ||
|
||
&:not(.p-inputswitch-checked) .p-inputswitch-slider::after { | ||
@apply | ||
tw-content-toggle-text-no tw-flex tw-justify-center tw-items-center tw-absolute tw-text-12-px tw-text-white tw-font-500 tw-left-24-px tw-bottom-0 #{!important}; | ||
} | ||
} | ||
|
||
[data-theme='co'] { | ||
.p-inputswitch .p-inputswitch-slider:before { | ||
@apply tw-w-18-px tw-h-18-px tw-left-0 tw-mt-[-0.55rem] tw-ml-2-px #{!important}; | ||
} | ||
} |
23 changes: 21 additions & 2 deletions
23
src/app/shared/components/input/toggle/toggle.component.ts
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,19 +1,38 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { FormGroup } from '@angular/forms'; | ||
import { brandingContent } from 'src/app/branding/branding-config'; | ||
import { AppName } from 'src/app/core/models/enum/enum.model'; | ||
|
||
@Component({ | ||
selector: 'app-toggle', | ||
templateUrl: './toggle.component.html', | ||
styleUrls: ['./toggle.component.scss'] | ||
}) | ||
export class ToggleComponent { | ||
export class ToggleComponent implements OnInit { | ||
|
||
@Input() form: FormGroup; | ||
|
||
@Input() formControllerName: string; | ||
|
||
@Input() isDisabled: boolean; | ||
|
||
@Input() toolTipText: string = ''; | ||
|
||
@Output() toggleChange = new EventEmitter(); | ||
|
||
@Output() toggleClick = new EventEmitter(); | ||
|
||
constructor() { } | ||
|
||
onToggleChange() { | ||
this.toggleChange.emit(); | ||
} | ||
|
||
onToggleClick() { | ||
this.toggleClick.emit(); | ||
} | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
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