light and darkmode change logic & disable buttons after start spin & format

This commit is contained in:
p-wojt
2022-01-12 23:33:44 +01:00
parent 3707a32c94
commit 6811b6d771
10 changed files with 208 additions and 191 deletions

View File

@@ -2,31 +2,30 @@ import { Item } from "./item";
import { List } from "./list";
export class ItemList implements List<Item> {
items: Item[];
maximumSize: number;
items: Item[];
maximumSize: number;
constructor(maxSize: number){
this.items = [];
this.maximumSize = maxSize;
}
constructor(maxSize: number) {
this.items = [];
this.maximumSize = maxSize;
}
add(item: Item){
if(this.items.length < this.maximumSize)
this.items.push(item);
}
add(item: Item) {
if (this.items.length < this.maximumSize) this.items.push(item);
}
removeById(id: number){
const toRemove = this.items.find(e => e.id === id);
if(toRemove){
this.remove(toRemove);
}
removeById(id: number) {
const toRemove = this.items.find((e) => e.id === id);
if (toRemove) {
this.remove(toRemove);
}
}
remove(item: Item){
this.items.splice(this.items.indexOf(item), 1);
}
remove(item: Item) {
this.items.splice(this.items.indexOf(item), 1);
}
clear(){
this.items = [];
}
}
clear() {
this.items = [];
}
}

View File

@@ -1,5 +1,5 @@
export interface List<T> {
items: T[];
add(item: T): void;
}
items: T[];
add(item: T): void;
}