From 5a8f0263f0a96554cac08bdfa16b000a6b5da6ca Mon Sep 17 00:00:00 2001 From: Kira Jiroux Date: Wed, 19 Feb 2025 16:57:49 -0500 Subject: [PATCH] Serving colors with ratings. --- .../Components/Pages/PokemonRate.razor | 69 +++++++++++++++++-- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/Portfolio.WebUI.Server/Components/Pages/PokemonRate.razor b/Portfolio.WebUI.Server/Components/Pages/PokemonRate.razor index b2ce1fd..6272d0a 100644 --- a/Portfolio.WebUI.Server/Components/Pages/PokemonRate.razor +++ b/Portfolio.WebUI.Server/Components/Pages/PokemonRate.razor @@ -51,8 +51,6 @@ height: 30px; color: white; padding: 4px 8px; - text-align: center; - vertical-align: middle; border-radius: 30px; } .statText { @@ -86,7 +84,15 @@ background-color: #47a0fc; } - + .finalScore { + width: 30px; + height: 30px; + color: white; + padding: 4px 8px; + text-align: center; + vertical-align: middle; + border-radius: 3px; + } @@ -266,11 +272,13 @@ else - +
-

Final Score: @FinalScore

+

Final Score: @FinalScore

+ + } @@ -310,6 +318,8 @@ else private Pokemon SelectedPokemon; private int FinalScore; + private string ScoreBackgroundColor; + private string ScoreColor; private string PokemonImageUrl => SelectedPokemon != null ? $"https://www.serebii.net/pokemonsleep/pokemon/{SelectedPokemon.Id}.png" @@ -323,7 +333,7 @@ else if (PokemonList is not null) { - + PokemonList.Sort((x, y) => x.PokemonId.CompareTo(y.PokemonId)); // Initialize dictionary with false (show base image first) @@ -377,5 +387,52 @@ else "Skills" => nature.SkillRating + subskill1.SkillRank + subskill2.SkillRank + subskill3.SkillRank, _ => 0 }; + + ScoreBackgroundColor = FinalScore switch + { + 8 => "#16C47F", + 7 => "#33CB8F", + 6 => "#50D39F", + 5 => "#6DDAAF", + 4 => "#8BE2BF", + 3 => "#A8E9CF", + 2 => "#C5F0DF", + 1 => "#E2F8EF", + 0 => "#FFFFFF", + -1 => "#FFE7E7", + -2 => "#FED0D0", + -3 => "#FEB8B8", + -4 => "#FDA0A0", + -5 => "#FD8888", + -6 => "#FC7171", + -7 => "#FC5959", + -8 => "#FB4141", + _ => "#FFFFFF" + + }; + ScoreColor = FinalScore switch + { + 8 => "#FFFFFF", + 7 => "#FFFFFF", + 6 => "#FFFFFF", + 5 => "#FFFFFF", + 4 => "#FFFFFF", + 3 => "#FFFFFF", + 2 => "#FFFFFF", + 1 => "#FFFFFF", + 0 => "#000", + -1 => "#FFFFFF", + -2 => "#FFFFFF", + -3 => "#FFFFFF", + -4 => "#FFFFFF", + -5 => "#FFFFFF", + -6 => "#FFFFFF", + -7 => "#FFFFFF", + -8 => "#FFFFFF", + _ => "#FFFFFF" + + }; } + + } \ No newline at end of file