mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Migracja pozostałych klas i komponentów na TS, optymalizacja kodu
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user