aboutsummaryrefslogtreecommitdiff
path: root/src/View/Project.hs
diff options
context:
space:
mode:
authorJoris Guyonvarch2014-04-06 22:55:16 +0200
committerJoris2019-05-01 15:34:22 +0200
commit0fe906ae7453aa684e998bbcc7a78b62d84f0206 (patch)
treed3968af830b964193349187fb6fc583780cd0ce3 /src/View/Project.hs
parent8b11c4be2b3ac354fa14534662dbd92374617a3e (diff)
Show resume and projects from a configuration file
Diffstat (limited to 'src/View/Project.hs')
-rw-r--r--src/View/Project.hs66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/View/Project.hs b/src/View/Project.hs
new file mode 100644
index 0000000..a5aaf2c
--- /dev/null
+++ b/src/View/Project.hs
@@ -0,0 +1,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