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 ""

View file

@ -13,7 +13,8 @@ make' (IndexInfo {title, galleries, links, footer}) = [b|@0
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<link rel=stylesheet href=/style/tum/index.css>
<link rel=stylesheet href=/style/shiny/index.css>
<link rel='alternate stylesheet' href=/style/tum/index.css>
<title>$*title</title>
@ -30,13 +31,13 @@ make' (IndexInfo {title, galleries, links, footer}) = [b|@0
|]
where
galleryList = if null galleries then "" else [b|@2
<ul class=gallery-list>
<ul id=gallery-list class=list>
$4.items
</ul>
|]
where items = map makeItem galleries
linkList = if null links then "" else [b|@2
<ul class=link-list>
<ul id=link-list class=list>
$4.items
</ul>
|]
@ -51,7 +52,7 @@ make' (IndexInfo {title, galleries, links, footer}) = [b|@0
makeItem :: GalleryInfo -> Builder
makeItem (GalleryInfo {title, description, prefix, filters}) = [b|@4
<li$nsfw><a href=$@prefix title="$*description">$*title</a>
<li$nsfw><a href=$@prefix title="$*description">$*title</a></li>
|]
where nsfw = if hasNsfw filters then " class=nsfw" else ""

View file

@ -33,7 +33,8 @@ make' nsfw (Info {date, title, artist, tags, nsfwTags,
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content='width=1200,viewport-fit=cover'>
<link rel=stylesheet href=/style/tum/single.css>
<link rel=stylesheet href=/style/shiny/single.css>
<link rel='alternate stylesheet' href=/style/tum/single.css>
<title>$*title</title>