Skip to content

Commit 20dd0e4

Browse files
[DSC-1872] Replaced 'ui-switch' in ProfilePageResearcherFormComponent
1 parent 3e2c6f1 commit 20dd0e4

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
<p>{{'researcher.profile.associated' | translate}}</p>
44
<p class="align-items-center researcher-profile-switch" >
55
<span class="mr-3">{{'researcher.profile.status' | translate}}</span>
6-
<ui-switch [checkedLabel]="'researcher.profile.public.visibility' | translate"
7-
[uncheckedLabel]="'researcher.profile.private.visibility' | translate"
8-
[checked]="researcherProfile.visible"
9-
(change)="toggleProfileVisibility(researcherProfile)" ></ui-switch>
6+
<ds-switch
7+
[options]="switchOptions"
8+
[selectedValue]="researcherProfile.visible ? 'public' : 'private'"
9+
(selectedValueChange)="toggleProfileVisibility(researcherProfile)">
10+
</ds-switch>
1011
</p>
1112
</div>
1213
<div *ngIf="!researcherProfile">

src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { isNotEmpty } from '../../shared/empty.util';
1919
import { followLink } from '../../shared/utils/follow-link-config.model';
2020
import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component';
2121
import { NoContent } from '../../core/shared/NoContent.model';
22+
import { SwitchColor, SwitchOption } from '../../shared/switch/switch.component';
2223

2324
@Component({
2425
selector: 'ds-profile-page-researcher-form',
@@ -56,6 +57,14 @@ export class ProfilePageResearcherFormComponent implements OnInit {
5657
*/
5758
researcherProfileItemId: string;
5859

60+
/**
61+
* The custom options for the 'ds-switch' component
62+
*/
63+
switchOptions: SwitchOption[] = [
64+
{ value: 'public', icon: 'fa fa-globe', labelColor: SwitchColor.Success, label: 'researcher.profile.public.visibility', iconColor: SwitchColor.Success },
65+
{ value: 'private', icon: 'fa fa-lock', labelColor: SwitchColor.Danger, label: 'researcher.profile.private.visibility', iconColor: SwitchColor.Danger },
66+
];
67+
5968
constructor(protected researcherProfileService: ResearcherProfileDataService,
6069
protected profileClaimService: ProfileClaimService,
6170
protected translationService: TranslateService,

0 commit comments

Comments
 (0)