add support for structured descriptions

This commit is contained in:
Rhiannon Morris 2021-03-07 22:08:44 +01:00
parent 519a50489f
commit 5c3ca348c2
3 changed files with 76 additions and 13 deletions

View file

@ -166,8 +166,9 @@ makeArtist (Artist {name, url}) =
Just u -> [b|<a href="$u">$name</a>|]
Nothing -> [b|$name|]
makeDesc :: Maybe Strict.Text -> Builder
makeDesc mdesc = ifJust mdesc \desc -> [b|@0
makeDesc :: Desc -> Builder
makeDesc NoDesc = ""
makeDesc (TextDesc desc) = [b|@0
<section id=desc class=info-section>
<h2>about</h2>
<div>
@ -175,6 +176,22 @@ makeDesc mdesc = ifJust mdesc \desc -> [b|@0
</div>
</section>
|]
makeDesc (LongDesc fs) = [b|@0
<section id=desc class=info-section>
<h2>about</h2>
<div>
$4.fields
</div>
</section>
|]
where
fields = map makeField fs
makeField (DescField {name, text}) = [b|@0
<h2>$name</h2>
<div>
$4.text
</div>
|]
makeButtonBar :: Strict.Text -> [(Image, Size)] -> Builder
makeButtonBar title images =