add bg property for displaying transparent images

This commit is contained in:
Rhiannon Morris 2020-08-10 05:42:18 +02:00
parent 1e0b955029
commit 8865b951fa
3 changed files with 12 additions and 4 deletions

View file

@ -122,11 +122,11 @@ makeYearItems nsfw year infos = [b|@4
year' = show year & foldMap \c -> [b|<span class=y>$'c</span>|]
makeItem :: Bool -> FilePath -> Info -> Builder
makeItem nsfw file info@(Info {title}) = [b|@4
makeItem nsfw file info@(Info {title, bg}) = [b|@4
<li class="item post$nsfw'" data-tags="$tags'">
<figure>
<a href="$@dir">
<img src="$@thumb">
<img src="$@thumb"$bgStyle>
</a>
<figcaption>$*title</figcaption>
</figure>
@ -136,3 +136,4 @@ makeItem nsfw file info@(Info {title}) = [b|@4
thumb = maybe (throw $ NoThumb dir) (\t -> dir </> thumbFile t) $ #thumb info
nsfw' = if nsfw && #anyNsfw info then " nsfw" else ""
tags' = fold $ intersperse ";" $ map fromText $ tagsFor nsfw info
bgStyle = ifJust bg \col -> [b| style="background: $*col"|]