Migracja pozostałych klas i komponentów na TS, optymalizacja kodu

This commit is contained in:
2020-07-21 18:32:37 +02:00
parent f78881dc46
commit 02838b2be3
10 changed files with 338 additions and 350 deletions
+41 -2
View File
@@ -4,10 +4,49 @@ import Component from 'vue-class-component'
// You can declare mixins as the same style as components.
@Component
export default class styleMixin extends Vue {
calculateStyle(exp: string | number): string {
const bgColor = exp < 2 ? "#26B0D9" : `hsl(${-exp * 5 + 100}, 65%, 50%)`;
calculateExpStyle(exp: string | number): string {
const bgColor =
exp > -1
? exp < 2
? "#26B0D9"
: `hsl(${-exp * 5 + 100}, 65%, 50%)`
: "#888";
const fontColor = exp > 15 ? "white" : "black";
return `backgroundColor: ${bgColor}; color: ${fontColor}`;
}
statusClasses(occupiedTo: string) {
let className = "";
switch (occupiedTo) {
case "WOLNA":
className = "free";
break;
case "KOŃCZY":
className = "ending";
break;
case "NIEZALOGOWANY":
className = "not-signed";
break;
case "BEZ LIMITU":
className = "no-limit";
break;
case "NIEDOSTĘPNY":
className = "unavailable";
break;
case "Z/W":
className = "brb";
break;
case "BRAK MIEJSCA":
className = "no-space";
break;
default:
break;
}
return className;
}
}