mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
refactor: migrate to material symbols icon set
This commit is contained in:
@@ -25,13 +25,10 @@ import {
|
||||
chipSkeletonTransition,
|
||||
chipTransition,
|
||||
} from '../../../../animation/skeleton-transitions/chip-loading-transition';
|
||||
|
||||
enum AddEventStates {
|
||||
ADDED_ALL,
|
||||
ADDED_SOME,
|
||||
REMOVED_ALL,
|
||||
UNAVAILABLE,
|
||||
}
|
||||
import {
|
||||
AddEventStates,
|
||||
AddEventStatesMap,
|
||||
} from './add-event-action-chip.config';
|
||||
|
||||
/**
|
||||
* Shows a horizontal list of action chips
|
||||
@@ -58,6 +55,8 @@ export class AddEventActionChipComponent implements OnDestroy {
|
||||
*/
|
||||
icon: string;
|
||||
|
||||
iconFill: boolean;
|
||||
|
||||
/**
|
||||
* Label
|
||||
*/
|
||||
@@ -71,28 +70,7 @@ export class AddEventActionChipComponent implements OnDestroy {
|
||||
/**
|
||||
* States
|
||||
*/
|
||||
states = {
|
||||
[AddEventStates.ADDED_ALL]: {
|
||||
icon: 'events-all',
|
||||
label: 'data.chips.add_events.ADDED_ALL',
|
||||
disabled: false,
|
||||
},
|
||||
[AddEventStates.ADDED_SOME]: {
|
||||
icon: 'events-partial',
|
||||
label: 'data.chips.add_events.ADDED_SOME',
|
||||
disabled: false,
|
||||
},
|
||||
[AddEventStates.REMOVED_ALL]: {
|
||||
icon: 'events',
|
||||
label: 'data.chips.add_events.REMOVED_ALL',
|
||||
disabled: false,
|
||||
},
|
||||
[AddEventStates.UNAVAILABLE]: {
|
||||
icon: 'close',
|
||||
label: 'data.chips.add_events.UNAVAILABLE',
|
||||
disabled: true,
|
||||
},
|
||||
};
|
||||
states = AddEventStatesMap;
|
||||
|
||||
/**
|
||||
* UUIDs
|
||||
@@ -115,9 +93,10 @@ export class AddEventActionChipComponent implements OnDestroy {
|
||||
*/
|
||||
applyState(state: AddEventStates) {
|
||||
this.state = state;
|
||||
const {label, icon, disabled} = this.states[state];
|
||||
const {label, icon, disabled, fill} = this.states[state];
|
||||
this.label = label;
|
||||
this.icon = icon;
|
||||
this.iconFill = fill;
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCIcon} from '../../../../util/ion-icon/icon';
|
||||
|
||||
export enum AddEventStates {
|
||||
ADDED_ALL,
|
||||
ADDED_SOME,
|
||||
REMOVED_ALL,
|
||||
UNAVAILABLE,
|
||||
}
|
||||
|
||||
export const AddEventStatesMap = {
|
||||
[AddEventStates.ADDED_ALL]: {
|
||||
icon: SCIcon`event_available`,
|
||||
fill: true,
|
||||
label: 'data.chips.add_events.ADDED_ALL',
|
||||
disabled: false,
|
||||
},
|
||||
[AddEventStates.ADDED_SOME]: {
|
||||
icon: SCIcon`event`,
|
||||
fill: true,
|
||||
label: 'data.chips.add_events.ADDED_SOME',
|
||||
disabled: false,
|
||||
},
|
||||
[AddEventStates.REMOVED_ALL]: {
|
||||
icon: SCIcon`calendar_today`,
|
||||
fill: false,
|
||||
label: 'data.chips.add_events.REMOVED_ALL',
|
||||
disabled: false,
|
||||
},
|
||||
[AddEventStates.UNAVAILABLE]: {
|
||||
icon: SCIcon`event_busy`,
|
||||
fill: false,
|
||||
label: 'data.chips.add_events.UNAVAILABLE',
|
||||
disabled: true,
|
||||
},
|
||||
};
|
||||
@@ -1,3 +1,18 @@
|
||||
<!--
|
||||
~ Copyright (C) 2022 StApps
|
||||
~ This program is free software: you can redistribute it and/or modify it
|
||||
~ under the terms of the GNU General Public License as published by the Free
|
||||
~ Software Foundation, version 3.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
~ more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with
|
||||
~ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<div class="stack-children">
|
||||
<ion-chip
|
||||
*ngIf="associatedDateSeries | async as associatedDateSeries; else loading"
|
||||
@@ -5,7 +20,7 @@
|
||||
[disabled]="disabled"
|
||||
(click)="$event.stopPropagation(); onClick($event)"
|
||||
>
|
||||
<ion-icon [name]="icon"></ion-icon>
|
||||
<ion-icon [name]="icon" [fill]="iconFill"></ion-icon>
|
||||
<ion-label>{{ label | translate }}</ion-label>
|
||||
</ion-chip>
|
||||
<ng-template #loading>
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
<!--
|
||||
~ Copyright (C) 2022 StApps
|
||||
~ This program is free software: you can redistribute it and/or modify it
|
||||
~ under the terms of the GNU General Public License as published by the Free
|
||||
~ Software Foundation, version 3.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
~ more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with
|
||||
~ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<ion-chip class="chip-class" (click)="$event.stopPropagation(); onClick()">
|
||||
<ion-icon name="location"></ion-icon>
|
||||
<ion-icon name="pin_drop"></ion-icon>
|
||||
<ion-label>{{ 'Locate' | translate }}</ion-label>
|
||||
<ng-template #loading>
|
||||
<ion-skeleton-text animated="true"></ion-skeleton-text>
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
<!--
|
||||
~ Copyright (C) 2022 StApps
|
||||
~ This program is free software: you can redistribute it and/or modify it
|
||||
~ under the terms of the GNU General Public License as published by the Free
|
||||
~ Software Foundation, version 3.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
~ more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with
|
||||
~ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<ion-chip
|
||||
[attr.color]="active ? 'primary' : 'medium'"
|
||||
(click)="emitToggle(value)"
|
||||
>
|
||||
<ion-icon name="circle-check" *ngIf="active"></ion-icon>
|
||||
<ion-icon name="check_circle" *ngIf="active"></ion-icon>
|
||||
<ion-label>{{ displayValue }}</ion-label>
|
||||
</ion-chip>
|
||||
|
||||
Reference in New Issue
Block a user