feat: add filter chips for news

This commit is contained in:
Jovan Krunić
2021-07-12 16:40:42 +02:00
parent e48134eddc
commit 5435f85cc4
27 changed files with 456 additions and 86 deletions

View File

@@ -0,0 +1,7 @@
<ion-chip
[attr.color]="active ? 'primary' : 'medium'"
(click)="emitToggle(value)"
>
<ion-icon name="checkmark-circle" *ngIf="active"></ion-icon>
<ion-label>{{ displayValue }}</ion-label>
</ion-chip>

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2021 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 {Component, EventEmitter, Input, Output} from '@angular/core';
/**
* Shows a chip filter
*/
@Component({
selector: 'stapps-chip-filter',
templateUrl: './chip-filter.component.html',
styleUrls: ['./chip-filter.component.scss'],
})
export class ChipFilterComponent {
/**
* If the chip (filter) is active
*/
@Input() active: boolean;
/**
* Text to display on the chip
*/
@Input() displayValue: string;
/**
* Emits when the chip has been activated/deactivated
*/
@Output() toggle = new EventEmitter<unknown>();
/**
* Value to emit when chip has been activated/deactivated
*/
@Input() value: unknown;
/**
* Signalize that the chip filter has been activated/deactivated
*/
emitToggle(value: unknown) {
this.toggle.emit(value);
}
}