Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(blog): make blog widget better #1740

Merged
merged 5 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/gno.land/p/demo/blog/blog.gno
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ type Blog struct {
}

func (b Blog) RenderLastPostsWidget(limit int) string {
if b.PostsPublished.Size() == 0 {
return "No posts."
}

output := ""
i := 0
b.Posts.Iterate("", "", func(key string, value interface{}) bool {
b.PostsPublished.ReverseIterate("", "", func(key string, value interface{}) bool {
p := value.(*Post)
output += ufmt.Sprintf("- [%s](%s)\n", p.Title, p.URL())
i++
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/gnoland/home/home.gno
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func Render(_ string) string {
func lastBlogposts(limit int) ui.Element {
posts := blog.RenderLastPostsWidget(limit)
return ui.Element{
ui.H3("Last Blogposts"),
ui.H3("Latest Blogposts"),
ui.Text(posts),
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/gnoland/home/home_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func main() {
//<div class="columns-3">
//<div class="column">
//
//### Last Blogposts
//
//### Latest Blogposts
//
//No posts.
//</div><!-- /column-->
//<div class="column">
//
Expand Down
Loading