mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
feat: add filter chips for news
This commit is contained in:
@@ -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>
|
||||
51
src/app/modules/data/chips/filter/chip-filter.component.ts
Normal file
51
src/app/modules/data/chips/filter/chip-filter.component.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user