new style

This commit is contained in:
Rhiannon Morris 2020-07-20 22:40:34 +02:00
parent 76e54d0297
commit 341c2baae3
11 changed files with 447 additions and 33 deletions

View file

@ -2,7 +2,7 @@
module GalleryPage (make) where
import Control.Exception
import Data.Function (on)
import Data.Function (on, (&))
import Data.List (sortOn, groupBy)
import qualified Data.Text.Lazy as Lazy
import System.FilePath ((</>), takeDirectory)
@ -27,7 +27,8 @@ make' title nsfw infos = [b|@0
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<link rel=stylesheet href=/style/tum/gallery.css>
<link rel=stylesheet href=/style/shiny/gallery.css>
<link rel='alternate stylesheet' href=/style/tum/gallery.css>
<link rel=alternate href=rss.xml type=application/rss+xml>
<title>$*title</title>
@ -61,14 +62,16 @@ makeYearItems :: Bool -- ^ nsfw
-> Builder
makeYearItems nsfw year infos = [b|@4
<li class="item year-marker">
<span class=year-text>$^year</span>
<span class=year-text>$year'</span>
$4.items
|]
where items = map (uncurry $ makeItem nsfw) infos
where
items = map (uncurry $ makeItem nsfw) infos
year' = show year & foldMap \c -> [b|<span class=y>$'c</span>|]
makeItem :: Bool -> FilePath -> Info -> Builder
makeItem nsfw file info@(Info {title}) = [b|@4
<li $cls>
<li class="item post$nsfw'">
<figure>
<a href="$@dir">
<img src="$@thumb">
@ -79,5 +82,4 @@ makeItem nsfw file info@(Info {title}) = [b|@4
where
dir = takeDirectory file
thumb = maybe (throw $ NoThumb dir) (\t -> dir </> thumbFile t) $ #thumb info
cls | nsfw && #anyNsfw info = [b|class="item nsfw"|]
| otherwise = [b|class=item|]
nsfw' = if nsfw && #anyNsfw info then " nsfw" else ""