Skip to content

Commit

Permalink
reformat based on editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tesar-tech committed Oct 16, 2024
1 parent b73688f commit 004d186
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 102 deletions.
34 changes: 17 additions & 17 deletions BlazorStaticMinimalBlog.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup >
<PackageReference Include="BlazorStatic" Version="1.0.0-beta.13"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BlazorStatic" Version="1.0.0-beta.13"/>
</ItemGroup>

<ItemGroup>
<None Update="Content/**/*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="Content/**/*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>


<!-- to make hot reload work on .md files -->
<ItemGroup>
<Watch Include="Content/**/*"/>
</ItemGroup>
<!-- to make hot reload work on .md files -->
<ItemGroup>
<Watch Include="Content/**/*"/>
</ItemGroup>


</Project>
14 changes: 7 additions & 7 deletions Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<base href="/"/>
<script src="https://cdn.tailwindcss.com?plugins=typography"></script>
<script>
tailwind.config = {
Expand All @@ -17,13 +17,13 @@
},},
}
</script>
<HeadOutlet />


<HeadOutlet/>
</head>

<body class="bg-gray-950 font-sans text-gray-200">
<Routes />
<Routes/>
</body>

</html>
2 changes: 1 addition & 1 deletion Components/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</a>
</div>
<div class="mb-2 flex space-x-2 text-sm text-gray-400">
<a target="_blank" rel="noopener noreferrer" href="https://github.com/tesar-tech/blazorStatic"> Built with Blazor Static</a>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/tesar-tech/blazorStatic"> Built with Blazor Static</a>
<div>•</div>
<div@DateTime.Now.Year</div>
</div>
Expand Down
19 changes: 10 additions & 9 deletions Components/Layout/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<header class="flex items-center justify-between py-10">
<div>
<a href="">
<a href="">
<div class="flex items-center justify-between">
<div class=" h-6 text-2xl font-semibold sm:block text-primary-800">@WebsiteKeys.Title</div>
</div>
Expand All @@ -11,13 +11,14 @@
<div class="flex items-center space-x-4 leading-5 sm:space-x-6">
@foreach(var item in menuItems)
{
<NavLink ActiveClass="bg-primary-950 px-2 py-1 rounded-xl" class="hidden font-medium text-gray-100 sm:block"
Match="@(item.Link==""?NavLinkMatch.All:NavLinkMatch.Prefix)" href="@item.Link">@((MarkupString)item.Name)
<Svg Icon="item.Icon"/>
</NavLink>
<NavLink ActiveClass="bg-primary-950 px-2 py-1 rounded-xl" class="hidden font-medium text-gray-100 sm:block"
Match="@(item.Link == "" ? NavLinkMatch.All : NavLinkMatch.Prefix)" href="@item.Link">
@((MarkupString)item.Name)
<Svg Icon="item.Icon"/>
</NavLink>

@* <a class="hidden font-medium text-gray-100 sm:block @(Nm.Uri.EndsWith(item.link)?"":"") " href="@item.link">@item.name</a> *@
}
}
<button id="toggle-button" aria-label="Toggle Menu" class="sm:hidden">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-8 w-8 text-gray-100">
<path fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd"></path>
Expand All @@ -32,7 +33,7 @@
</button>
</div>
<nav class="fixed mt-8 h-full">
@foreach (var item in menuItems)
@foreach(var item in menuItems)
{
<div class="px-12 py-4">
<NavLink ActiveClass="underline" class="text-2xl font-bold tracking-widest text-gray-100"
Expand Down Expand Up @@ -63,7 +64,7 @@
new("Tags", "tags"),
new("", WebsiteKeys.GitHubRepo, Svg.Icons.Github)
];


record MenuItem(string Name, string Link, Svg.Icons? Icon = null);
}
14 changes: 7 additions & 7 deletions Components/Pages/Blog.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/"
@page "/"
@page "/blog/{fileName}"
@using System.Globalization
@using BlazorStatic
Expand All @@ -14,8 +14,8 @@
<h1 class="font-sans md:leading-14 text-3xl font-extrabold leading-9 tracking-tight text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl">Latest</h1>
<p class="text-lg leading-7 text-gray-400 prose prose-invert">@WebsiteKeys.BlogLead</p>
</div>
<PostsList />

<PostsList/>
</div>
return;
}
Expand Down Expand Up @@ -51,7 +51,7 @@
<dt class="sr-only">Authors</dt>
<dd>
<ul class="flex flex-wrap justify-center gap-4 sm:space-x-12 xl:block xl:space-x-0 xl:space-y-8">
@foreach (var author in post.FrontMatter.Authors)
@foreach(var author in post.FrontMatter.Authors)
{
<li class="flex items-center space-x-2">
@* <img alt="avatar" loading="lazy" width="38" height="38" decoding="async" data-nimg="1" class="h-10 w-10 rounded-full" srcset="/_next/image?url=%2Fstatic%2Fimages%2Favatar.png&amp;w=48&amp;q=75 1x, /_next/image?url=%2Fstatic%2Fimages%2Favatar.png&amp;w=96&amp;q=75 2x" src="/_next/image?url=%2Fstatic%2Fimages%2Favatar.png&amp;w=96&amp;q=75" style="color: transparent;"/> *@
Expand Down Expand Up @@ -94,7 +94,7 @@
<div class="py-4 xl:py-8">
<h2 class="text-xs uppercase tracking-wide text-gray-400">Tags</h2>
<div class="flex flex-wrap">
@foreach (var tag in post.FrontMatter.Tags)
@foreach(var tag in post.FrontMatter.Tags)
{
<a class="text-primary-500 hover:text-primary-400 mr-3 text-sm font-medium uppercase" href="@blazorStaticContentService.Options.TagsPageUrl/@tag">@tag</a>
}
Expand All @@ -113,10 +113,10 @@
@code{
[Parameter] public string? FileName { get; set; }
Post<BlogFrontMatter>? post;

protected override void OnInitialized()
{
if (string.IsNullOrWhiteSpace(FileName)) return;
post = blazorStaticContentService.Posts.FirstOrDefault(x => x.Url == FileName);
}
}
}
23 changes: 12 additions & 11 deletions Components/Pages/Tags.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.Select(group => new { Tag = group.Key, Count = group.Count() })
.OrderByDescending(x => x.Count);

foreach (var tag in tagsWithCount)
foreach(var tag in tagsWithCount)
{
<a class="text-primary-500 hover:text-primary-400 mr-3 text-sm font-medium uppercase" href="@blazorStaticContentService.Options.TagsPageUrl/@WebUtility.HtmlEncode(tag.Tag)">@tag.Tag (@tag.Count)</a>
}
Expand All @@ -28,23 +28,24 @@
<div class="divide-y divide-gray-700">
<div class="space-y-2 pb-8 pt-6 md:space-y-5">
<h1 class="font-sans md:leading-14 text-3xl font-extrabold leading-9 tracking-tight text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl">@TagName</h1>
<p class="text-lg leading-7 text-gray-400">Blog posts tagged by
<span class="text-primary-300">@TagName</span>
</p>
<p class="text-lg leading-7 text-gray-400">
Blog posts tagged by
<span class="text-primary-300">@TagName</span>
</p>
</div>
<PostsList Posts="posts"/>
<PostsList Posts="posts"/>
</div>

@code {

[Parameter] public string? TagName { get; set; }

List<Post<BlogFrontMatter>>? posts;

protected override void OnInitialized()
{
if (string.IsNullOrWhiteSpace(TagName)) return;
posts = blazorStaticContentService.Posts.Where(x => x.FrontMatter.Tags.Contains(TagName)).ToList();
posts = blazorStaticContentService.Posts.Where(x => x.FrontMatter.Tags.Contains(TagName)).ToList();
}
}

}
6 changes: 3 additions & 3 deletions Components/PostsList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@inject BlazorStaticService blazorStaticService

<ul class="divide-y divide-gray-700">
@foreach (var post in posts.OrderByDescending(x => x.FrontMatter.Published))
@foreach(var post in posts.OrderByDescending(x => x.FrontMatter.Published))
{
<li class="py-12">
<article>
Expand All @@ -27,7 +27,7 @@
<a class="text-gray-100" href="@blazorStaticContentService.Options.PageUrl/@(post.Url)">@post.FrontMatter.Title</a>
</h2>
<div class="flex flex-wrap">
@foreach (var tag in post.FrontMatter.Tags)
@foreach(var tag in post.FrontMatter.Tags)
{
<a class="text-primary-500 hover:text-primary-400 mr-3 text-sm font-medium uppercase" href="@blazorStaticContentService.Options.TagsPageUrl/@tag">@tag</a>
}
Expand Down Expand Up @@ -58,4 +58,4 @@
posts = Posts != null ? Posts.OrderBy(x => x.FrontMatter.Published).ToList() : blazorStaticContentService.Posts;
base.OnInitialized();
}
}
}
4 changes: 2 additions & 2 deletions Components/Routes.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)"/>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found>
</Router>
9 changes: 3 additions & 6 deletions Components/Svg.razor
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@
@code {
[Parameter, EditorRequired] public Icons? Icon { get; set; }
[Parameter] public string SizeClasses { get; set; } = "h-6 w-6";
public enum Icons{
X,
Github
}

public enum Icons { X, Github }

string IconToViewBox(Icons? icon) => icon switch
{
Icons.X => "0 0 50 50",
Icons.Github => "0 0 24 24",
_ => "0 0 24 24"
};
}
}
11 changes: 8 additions & 3 deletions Content/Blog/second-post.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Second post
lead: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui.
lead: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui.
published: 2023-11-05
tags: [tag-001, another-sample-tag]
authors:
Expand All @@ -9,8 +9,13 @@ authors:
xUserName: "tesar_tech"
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.
Vestibulum quis lacinia eros. Fusce ac metus non purus sollicitudin laoreet. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh.
Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus.
Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus
sollicitudin laoreet.
Vestibulum quis lacinia eros. Fusce ac metus non purus sollicitudin laoreet. Praesent a hendrerit urna. In non imperdiet
elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.



3 changes: 1 addition & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
if(!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
Expand All @@ -40,5 +40,4 @@ public static class WebsiteKeys
public const string Title = "BlazorStatic Minimal Blog";
public const string BlogPostStorageAddress = $"{GitHubRepo}/tree/main/Content/Blog";
public const string BlogLead = "Sample blog created with BlazorStatic and TailwindCSS";

}
62 changes: 31 additions & 31 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:6196",
"sslPort": 44359
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:6196",
"sslPort": 44359
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5077",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7103;http://localhost:5077",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5077",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7103;http://localhost:5077",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Loading

0 comments on commit 004d186

Please sign in to comment.