blob: a5aaf2ce7c41ea4a8a9b68085fa633ce18931464 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{-# LANGUAGE OverloadedStrings #-}
module View.Project
( renderProjects
) where
import Data.String (fromString)
import Text.Blaze.Html
import Text.Blaze.Html5
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5 as H
import Conf (Conf)
import Model.Header (Header(Projects))
import qualified Model.Project as P
import Model.Translated
import Model.Translation.Language
import View.Header (renderHeader)
import View.Git (renderGitIcon)
renderProjects :: Conf -> Language -> [P.Project] -> Html
renderProjects conf language projects =
H.div $ do
renderHeader language (Just Projects)
H.div ! class_ "projectsPage" $
mapM_ (renderProject conf language) projects
renderProject :: Conf -> Language -> P.Project -> Html
renderProject conf language project =
H.div ! class_ "project" $ do
renderTitle conf project
H.div ! class_ "body" $ do
renderTechnologies (P.technologies project)
case P.pageLink project of
Just pageLink -> renderPageLink pageLink
Nothing -> fromString ""
case P.description project of
Just description -> renderDescription language description
Nothing -> H.div ""
renderTitle :: Conf -> P.Project -> Html
renderTitle conf project =
h1 $ do
toHtml (P.name project)
H.span ! class_ "separator" $ fromString " − "
renderGitIcon conf (P.git project)
renderTechnologies :: [String] -> Html
renderTechnologies technologies =
H.div ! class_ "technologies" $ do
ul $ mapM_ (H.li . fromString) technologies
renderPageLink :: String -> Html
renderPageLink pageLink =
H.div ! class_ "pageLink" $ do
H.a
! href (fromString pageLink)
$ toHtml pageLink
renderDescription :: Language -> Translated -> Html
renderDescription language description =
H.div ! class_ "description" $ do
fromString . getTranslation language $ description
|