mirror of
https://github.com/starshardstudio/peafowl.git
synced 2024-11-23 13:34:20 +00:00
44 lines
903 B
TypeScript
44 lines
903 B
TypeScript
|
export type Rating = number
|
||
|
|
||
|
export function ratingToIconDef(rating?: Rating): string {
|
||
|
if(rating === undefined) {
|
||
|
return "fa-face-meh-blank"
|
||
|
}
|
||
|
else if(rating == 0) {
|
||
|
return "fa-face-meh-blank"
|
||
|
}
|
||
|
else if(rating < 35) {
|
||
|
return "fa-face-frown"
|
||
|
}
|
||
|
else if(rating < 65) {
|
||
|
return "fa-face-meh"
|
||
|
}
|
||
|
else if(rating < 95) {
|
||
|
return "fa-face-smile"
|
||
|
}
|
||
|
else {
|
||
|
return "fa-face-grin-stars"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export function ratingToClassName(rating?: Rating): string {
|
||
|
if(rating === undefined) {
|
||
|
return "rating-unset"
|
||
|
}
|
||
|
else if(rating === 0) {
|
||
|
return "rating-unset"
|
||
|
}
|
||
|
else if(rating < 35) {
|
||
|
return "rating-bad"
|
||
|
}
|
||
|
else if(rating < 65) {
|
||
|
return "rating-mixed"
|
||
|
}
|
||
|
else if(rating < 95) {
|
||
|
return "rating-good"
|
||
|
}
|
||
|
else {
|
||
|
return "rating-perfect"
|
||
|
}
|
||
|
}
|