This addition uses the Character pixy mixin which displays the characters with a size that may be too big compared to the other type search results. As discussed on Discord this display can be adjusted in the future. This addition also displays a maximum of 5 characters which is obviously open to being changed since it's a number picked just for testing and not for usability. Lastly on the search.pixy file I left the comment below the addition since removing it or rewriting the addition without it broke my build.
80 lines
2.4 KiB
Plaintext
80 lines
2.4 KiB
Plaintext
component SearchResults(term string, users []*arn.User, animes []*arn.Anime, posts []*arn.Post, threads []*arn.Thread, tracks []*arn.SoundTrack, characters []*arn.Character)
|
|
h1.page-title= "Search: " + term
|
|
|
|
.search
|
|
.widget
|
|
h3.widget-title
|
|
Icon("tv")
|
|
span Anime
|
|
|
|
.profile-watching-list.anime-search
|
|
if len(animes) == 0
|
|
p.no-search-results.mountable No anime found.
|
|
else
|
|
each anime in animes
|
|
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
|
img.anime-cover-image.anime-search-result(src=anime.Image("small"), data-webp="true", alt=anime.Title.Canonical)
|
|
|
|
.widget
|
|
h3.widget-title
|
|
Icon("comment")
|
|
span Forum
|
|
|
|
if len(posts) == 0 && len(threads) == 0
|
|
p.no-search-results.mountable No posts found.
|
|
else
|
|
each thread in threads
|
|
.mountable(data-mountable-type="forum")
|
|
.forum-search-result
|
|
a.forum-search-result-title.ajax(href=thread.Link())= thread.Title
|
|
if thread.Author().HasNick()
|
|
.forum-search-result-author= thread.Author().Nick
|
|
.forum-search-result-sample= thread.Text
|
|
|
|
each post in posts
|
|
.mountable(data-mountable-type="forum")
|
|
.forum-search-result
|
|
a.forum-search-result-title.ajax(href=post.Link(), data-mountable-type="forum")= post.Thread().Title
|
|
if post.Author().HasNick()
|
|
.forum-search-result-author= post.Author().Nick
|
|
.forum-search-result-sample= post.Text
|
|
|
|
.widget
|
|
h3.widget-title
|
|
Icon("music")
|
|
span Soundtracks
|
|
|
|
if len(tracks) == 0
|
|
p.no-search-results.mountable No soundtracks found.
|
|
else
|
|
ul.soundtrack-search
|
|
each track in tracks
|
|
li.mountable(data-mountable-type="track")
|
|
a.ajax(href=track.Link())= track.Title
|
|
|
|
.widget
|
|
h3.widget-title
|
|
Icon("user")
|
|
span Users
|
|
|
|
.user-avatars.user-search
|
|
if len(users) == 0
|
|
p.no-search-results.mountable No users found.
|
|
else
|
|
each user in users
|
|
.mountable(data-mountable-type="user")
|
|
Avatar(user)
|
|
//- a.ajax(href=user.Link())= user.Nick
|
|
.widget
|
|
h3.widget-title
|
|
Icon("user")
|
|
span Characters
|
|
|
|
.user-avatars.user-search
|
|
if len(characters) == 0
|
|
p.no-search-results.mountable No characters found.
|
|
else
|
|
each character in characters
|
|
.mountable(data-mountable-type="character")
|
|
Character(character)
|
|
//- a.ajax(href=user.Link())= user.Nick |