make download link more obvious but hide it for tiny images

This commit is contained in:
Rhiannon Morris 2020-11-24 21:18:20 +01:00
parent 9a54cc0d53
commit ed88f03bab
2 changed files with 8 additions and 4 deletions

View file

@ -51,6 +51,7 @@ make' root prefix nsfw dataDir dir info@(Info {date, title, artist, bg}) = do
= head images
let download0 = fromMaybe path0 download0'
let path0' = pageFile path0
let tinyCls = if any (tiny . #second) images then [b| class=tiny|] else ""
let descSection = makeDesc $ descFor nsfw info
let tagsList = makeTags undir $ tagsFor nsfw info
@ -126,7 +127,7 @@ make' root prefix nsfw dataDir dir info@(Info {date, title, artist, bg}) = do
$2.buttonBar
<main>
<figure id=mainfig data-width=$width0 data-height=$height0>
<figure id=mainfig data-width=$width0 data-height=$height0$tinyCls>
$warning'
<a id=mainlink href="$download0" title="download full version">
<img id=mainimg src="$path0'" alt="">
@ -261,6 +262,9 @@ makeUpdate (Update {date, desc}) = [b|@8
data Size = Size {width, height :: !Int} deriving (Eq, Show)
tiny :: Size -> Bool
tiny (Size {width, height}) = width < 250 || height < 250
imageSize :: FilePath -> FilePath -> IO Size
imageSize dir img = do
-- "[0]" to get the first frame of an animation