Skip to content

Commit

Permalink
Added Footer
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Jan 19, 2022
1 parent 2e9d31f commit 57b4e4c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/LinkDotNet.Blog.Web/Shared/Footer.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@inject AppConfiguration appConfiguration

<div class="py-4">
<footer class="text-center container">
<span class="py-2 mb-0 text-muted"@DateTime.Now.Year @CopyrightName</span>
</footer>
</div>
@code {
private string CopyrightName => appConfiguration.IsAboutMeEnabled
? appConfiguration.ProfileInformation.Name
: string.Empty;
}
13 changes: 8 additions & 5 deletions src/LinkDotNet.Blog.Web/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
<BlazoredToasts Position="ToastPosition.BottomRight" />
<div class="position-relative">
<NavMenu/>

<div class="page">
@Body
</div>
</div>

<main>
<div class="page">
@Body
</div>
</main>
</div>
<Footer></Footer>
2 changes: 1 addition & 1 deletion src/LinkDotNet.Blog.Web/wwwroot/css/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
--big-stone: #193441;

--white: #ffffff;
--wild-sand: #f4f4f4;
--wild-sand: #f4f4f4;

/* Usages - this colors have to be defined in every theme */
--active-link: var(--big-stone);
Expand Down
40 changes: 40 additions & 0 deletions tests/LinkDotNet.Blog.UnitTests/Web/Shared/FooterTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Bunit;
using FluentAssertions;
using LinkDotNet.Blog.Domain;
using LinkDotNet.Blog.Web;
using LinkDotNet.Blog.Web.Shared;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace LinkDotNet.Blog.UnitTests.Web.Shared;

public class FooterTests : TestContext
{
[Fact]
public void ShouldSetCopyrightInformation()
{
var appConfig = new AppConfiguration
{
ProfileInformation = new ProfileInformation()
{
Name = "Steven",
},
};
Services.AddScoped(_ => appConfig);

var cut = RenderComponent<Footer>();

cut.Find("span").TextContent.Should().Contain("Steven");
}

[Fact]
public void ShouldNotSetNameIfAboutMeIsNotEnabled()
{
var appConfig = new AppConfiguration();
Services.AddScoped(_ => appConfig);

var cut = RenderComponent<Footer>();

cut.Find("span").TextContent.Should().Contain("©");
}
}

0 comments on commit 57b4e4c

Please sign in to comment.