Skip to content

Commit d3065c2

Browse files
committed
fix: Social Accounts and Show youtube
1 parent ddb0033 commit d3065c2

File tree

6 files changed

+29
-12
lines changed

6 files changed

+29
-12
lines changed

src/LinkDotNet.Blog.Domain/Social.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ public sealed record Social
44
{
55
public const string SocialSection = "Social";
66

7-
public string? LinkedinAccountUrl { get; init; }
7+
public string? LinkedInAccountUrl { get; init; }
88

9-
public bool HasLinkedinAccount => !string.IsNullOrEmpty(LinkedinAccountUrl);
9+
public bool HasLinkedinAccount => !string.IsNullOrEmpty(LinkedInAccountUrl);
1010

1111
public string? GithubAccountUrl { get; init; }
1212

@@ -15,4 +15,8 @@ public sealed record Social
1515
public string? TwitterAccountUrl { get; init; }
1616

1717
public bool HasTwitterAccount => !string.IsNullOrEmpty(TwitterAccountUrl);
18+
19+
public string? YoutubeAccountUrl { get; init; }
20+
21+
public bool HasYoutubeAccount => !string.IsNullOrEmpty(YoutubeAccountUrl);
1822
}

src/LinkDotNet.Blog.Web/ConfigurationExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private static IServiceCollection AddSocialConfigurations(this IServiceCollectio
7474
{
7575
ArgumentNullException.ThrowIfNull(services);
7676

77-
services.AddOptions<AuthInformation>()
77+
services.AddOptions<Social>()
7878
.Configure<IConfiguration>((settings, config) =>
7979
{
8080
config.GetSection(Social.SocialSection).Bind(settings);

src/LinkDotNet.Blog.Web/Features/Home/Components/SocialAccounts.razor

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="d-flex flex-row justify-content-center" style="font-size: 1.25em;">
33
@if (Social.HasLinkedinAccount)
44
{
5-
<a id="linkedin" class="nav-link px-3 py-2" target="_blank" href="@Social.LinkedinAccountUrl" aria-label="LinkedIn" rel="noreferrer">
5+
<a id="linkedin" class="nav-link px-3 py-2" target="_blank" href="@Social.LinkedInAccountUrl" aria-label="LinkedIn" rel="noreferrer">
66
<i class="linkedin"></i>
77
</a>
88
}
@@ -18,6 +18,13 @@
1818
<i class="twitter"></i>
1919
</a>
2020
}
21+
22+
@if (Social.HasYoutubeAccount)
23+
{
24+
<a id="youtube" class="nav-link px-3 py-2" target="_blank" href="@Social.YoutubeAccountUrl" aria-label="Youtube" rel="noreferrer">
25+
<i class="youtube"></i>
26+
</a>
27+
}
2128
</div>
2229

2330
@code {

src/LinkDotNet.Blog.Web/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"Social": {
1313
"GithubAccountUrl": "",
1414
"LinkedInAccountUrl": "",
15-
"TwitterAccountUrl": ""
15+
"TwitterAccountUrl": "",
16+
"YoutubeAccountUrl": ""
1617
},
1718
"Introduction": {
1819
"Description": "A small introduction to your **blog**. Can be in markdown",

tests/LinkDotNet.Blog.UnitTests/Web/ApplicationConfigurationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void ShouldMapFromAppConfiguration()
100100
configuration.GetSection(Social.SocialSection).Bind(social);
101101
social.GithubAccountUrl.ShouldBe("github");
102102
social.HasGithubAccount.ShouldBeTrue();
103-
social.LinkedinAccountUrl.ShouldBe("linkedIn");
103+
social.LinkedInAccountUrl.ShouldBe("linkedIn");
104104
social.HasLinkedinAccount.ShouldBeTrue();
105105
social.TwitterAccountUrl.ShouldBe("twitter");
106106
social.HasTwitterAccount.ShouldBeTrue();

tests/LinkDotNet.Blog.UnitTests/Web/Features/Home/Components/SocialAccountTests.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,34 @@ namespace LinkDotNet.Blog.UnitTests.Web.Features.Home.Components;
77
public class SocialAccountTests : BunitContext
88
{
99
[Theory]
10-
[InlineData(null, null, null, false, false, false)]
11-
[InlineData(null, "linkedin", null, false, true, false)]
12-
[InlineData("github", null, null, true, false, false)]
13-
[InlineData(null, null, "twitter", false, false, true)]
10+
[InlineData(null, null, null, null, false, false, false, false)]
11+
[InlineData(null, "linkedin", null, null, false, true, false, false)]
12+
[InlineData("github", null, null, null, true, false, false, false)]
13+
[InlineData(null, null, "twitter", null, false, false, true, false)]
14+
[InlineData(null, null, null, "youtube", false, false, false, true)]
1415
public void ShouldDisplayGithubAndLinkedInPageWhenOnlyWhenSet(
1516
string? github,
1617
string? linkedin,
1718
string? twitter,
19+
string? youtube,
1820
bool githubAvailable,
1921
bool linkedinAvailable,
20-
bool twitterAvailable)
22+
bool twitterAvailable,
23+
bool youtubeAvailable)
2124
{
2225
var social = new Social
2326
{
2427
GithubAccountUrl = github,
25-
LinkedinAccountUrl = linkedin,
28+
LinkedInAccountUrl = linkedin,
2629
TwitterAccountUrl = twitter,
30+
YoutubeAccountUrl = youtube,
2731
};
2832

2933
var cut = Render<SocialAccounts>(s => s.Add(p => p.Social, social));
3034

3135
cut.FindAll("#github").Any().ShouldBe(githubAvailable);
3236
cut.FindAll("#linkedin").Any().ShouldBe(linkedinAvailable);
3337
cut.FindAll("#twitter").Any().ShouldBe(twitterAvailable);
38+
cut.FindAll("#youtube").Any().ShouldBe(youtubeAvailable);
3439
}
3540
}

0 commit comments

Comments
 (0)