blob: 880d69f2574bdcdda41fcbb6f8f976ff7936872e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
;;; Harmonic Flow web site
(define-module (apps media templates components)
#:use-module (apps aux lists)
#:use-module (apps aux web)
#:use-module (apps base templates components)
#:use-module (apps base utils)
#:use-module (apps i18n)
#:use-module (apps media types)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:export (screenshot->shtml
screenshots-box))
;;;
;;; Components.
;;;
(define (screenshot->shtml shot)
"Return an SHTML representation of the given screenshot object.
SHOT (<screenshot>)
A screenshot object as defined in (apps media types)."
`(div
(@ (class "screenshot-preview"))
(a
(@ (href ,(hfweb-url (url-path-join "screenshots"
(screenshot-slug shot) ""))))
(img
(@ (class "responsive-image")
(src ,(screenshot-preview shot))
(alt "")))
(span (@ (class "screenshot-inset-shadow")) ""))
(p ,(screenshot-caption shot) (span (@ (class "hidden")) "."))))
(define* (screenshots-box screenshots #:optional (n 6) #:key shadow)
"Return SHTML for a box displaying up to N many SCREENSHOTS randomly
chosen at build time. If SHADOW is true, a shadow is displayed at the
top."
`(div
(@ (class ,(string-join `("screenshots-box"
,@(if shadow
'("top-shadow-bg")
'())))))
,@(map screenshot->shtml (take-random screenshots n))))
|