feat: add individual post page (#4)
* chore: add markdown lint to ignore no h1 heading in markdown files * chore: update example settings * chore: update example development env file * fix: remove fixed 100% height on container * feat: add individual post page * chore: update README.md * feat: add links to headings in post and add copy button to code blocks * tests: add tests for get post async method * tests: remove heading for test blogs * fix: only add links to headings in markdown body * tests: add tests for post page * tests: add test to check for blog content * docs: add jsdoc comments * chore: fix incorrect env variable format in example * fix: don't render anything if blog post is null * fix: don't render anything until posts are fetched * chore: add docker compose file for prod
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
@inject IPostService postService
|
||||
@inject IJSRuntime JS
|
||||
|
||||
@if (posts.Count == 0)
|
||||
|
||||
@if (Posts is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (Posts.Count == 0)
|
||||
{
|
||||
<div class="container">
|
||||
<p>Looks like writers block. Check back later.</p>
|
||||
@@ -11,7 +16,7 @@
|
||||
else
|
||||
{
|
||||
<section role="feed" class="container">
|
||||
@foreach (var post in posts)
|
||||
@foreach (var post in Posts)
|
||||
{
|
||||
<a href="/@post.Slug">
|
||||
<article>
|
||||
@@ -25,10 +30,10 @@
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<Post> posts = [];
|
||||
private List<Post>? Posts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
posts = await postService.GetPostsAsync();
|
||||
Posts = await postService.GetPostsAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user