diff --git a/src/Client/Features/Admin/AddPlayer.razor b/src/Client/Features/Admin/AddPlayer.razor index 87c8d99..eace0d3 100644 --- a/src/Client/Features/Admin/AddPlayer.razor +++ b/src/Client/Features/Admin/AddPlayer.razor @@ -47,7 +47,7 @@ - + diff --git a/src/Client/Features/Dashboard/Shared/RankedCard.razor b/src/Client/Features/Dashboard/Shared/RankedCard.razor index 5c806e1..4ab4f67 100644 --- a/src/Client/Features/Dashboard/Shared/RankedCard.razor +++ b/src/Client/Features/Dashboard/Shared/RankedCard.razor @@ -1,7 +1,7 @@  - + @RankedItem.Name diff --git a/src/Client/Features/FreeAgents/Detail.razor b/src/Client/Features/FreeAgents/Detail.razor index 900cac5..a025a62 100644 --- a/src/Client/Features/FreeAgents/Detail.razor +++ b/src/Client/Features/FreeAgents/Detail.razor @@ -25,7 +25,7 @@ else - + @_result.Name diff --git a/src/Client/Features/Teams/List.razor b/src/Client/Features/Teams/List.razor index e043d4a..c94801f 100644 --- a/src/Client/Features/Teams/List.razor +++ b/src/Client/Features/Teams/List.razor @@ -46,7 +46,7 @@ else - + @team.Name diff --git a/src/Client/Shared/Components/Avatar.razor b/src/Client/Shared/Components/Avatar.razor new file mode 100644 index 0000000..c369e02 --- /dev/null +++ b/src/Client/Shared/Components/Avatar.razor @@ -0,0 +1,17 @@ +@if(string.IsNullOrEmpty(Image)) +{ +
+ +
+} +else +{ + +} + + +@code { + [Parameter] public string? Image { get; set; } + [Parameter] public Size Size { get; set; } = Size.Medium; + [Parameter(CaptureUnmatchedValues = true)] public Dictionary? AllOtherAttributes { get; set; } +} diff --git a/src/Client/Shared/Components/NameWithImage.razor b/src/Client/Shared/Components/NameWithImage.razor index 4a30093..d2011a8 100644 --- a/src/Client/Shared/Components/NameWithImage.razor +++ b/src/Client/Shared/Components/NameWithImage.razor @@ -1,5 +1,5 @@ 
- + @Name
diff --git a/src/Tests/Shared/Components/AvatarTests.cs b/src/Tests/Shared/Components/AvatarTests.cs new file mode 100644 index 0000000..aa6b260 --- /dev/null +++ b/src/Tests/Shared/Components/AvatarTests.cs @@ -0,0 +1,25 @@ +using DynamoLeagueBlazor.Client.Shared.Components; + +namespace DynamoLeagueBlazor.Tests.Shared.Components; + +public class AvatarTests : UITestBase +{ + [Fact] + public void GivenNoImageUrl_ThenIsAnIcon() + { + var component = RenderComponent(); + + component.Markup.Should().Contain("icon"); + } + + [Fact] + public void GivenAnImageUrl_ThenIsAnAvatar() + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.Image, RandomString); + }); + + component.Markup.Should().Contain("img"); + } +}