dark mode
This commit is contained in:
parent
d5ccdf60c1
commit
f465e9e367
2 changed files with 15 additions and 5 deletions
|
|
@ -34,7 +34,7 @@ export namespace Catcrafts {
|
|||
}
|
||||
}
|
||||
html += std::format(R"(
|
||||
<div class="post fade-in">
|
||||
<div class="post fade-in" id="blog-post-{}">
|
||||
<div class="post-header">
|
||||
<h2 class="post-title"><a>{}</a></h2>
|
||||
<span class="post-date">{}</span>
|
||||
|
|
@ -43,18 +43,20 @@ export namespace Catcrafts {
|
|||
{}
|
||||
</div>
|
||||
<div class="post-footer">
|
||||
<a id="blog-button-{}" class="btn">Read Full Post</a>
|
||||
<a class="btn">Read Full Post</a>
|
||||
</div>
|
||||
</div>)", post.name, post.date, previewContent, post.slug);
|
||||
</div>)", post.slug, post.name, post.date, previewContent);
|
||||
}
|
||||
main->SetInnerHTML(html);
|
||||
|
||||
for(const BlogPost& post : *posts) {
|
||||
HtmlElementView& view = blogButtons->emplace_back(std::format("blog-button-{}", post.slug));
|
||||
view.AddClickListener([slug = post.slug](Crafter::MouseEvent e) {
|
||||
// Add click listener to the entire post card
|
||||
HtmlElementView& cardView = blogButtons->emplace_back(std::format("blog-post-{}", post.slug));
|
||||
cardView.AddClickListener([slug = post.slug](Crafter::MouseEvent e) {
|
||||
PushState("{}", "", std::format("/blog/{}", slug));
|
||||
RenderRoot(std::format("/blog/{}", slug));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue