diff options
author | Joris | 2019-05-16 09:40:02 +0200 |
---|---|---|
committer | Joris | 2019-05-16 09:40:02 +0200 |
commit | 7bf58894761742d4da8e6f52ce113ea7327e7114 (patch) | |
tree | 388785f65e258e956296977cff4bd1f7ac6e1526 /client/src/view | |
parent | f015a216f5ee1e335d5ae90dbc8f3efafdca6fec (diff) |
Bootstrap
Diffstat (limited to 'client/src/view')
-rw-r--r-- | client/src/view/View.scala | 22 | ||||
-rw-r--r-- | client/src/view/index/Index.scala | 27 | ||||
-rw-r--r-- | client/src/view/licence/LicencePage.scala | 24 | ||||
-rw-r--r-- | client/src/view/notFound/NotFound.scala | 12 |
4 files changed, 85 insertions, 0 deletions
diff --git a/client/src/view/View.scala b/client/src/view/View.scala new file mode 100644 index 0000000..5c79a71 --- /dev/null +++ b/client/src/view/View.scala @@ -0,0 +1,22 @@ +package yoga.view + +import scala.xml.Node + +import yoga.router.Router + +object View { + + def apply(): Node = + <div> + <header> + <a href={Router.Path.index} class="header__link"> + YOGA + </a> + </header> + + <main> + {Router.render()} + </main> + </div> + +} diff --git a/client/src/view/index/Index.scala b/client/src/view/index/Index.scala new file mode 100644 index 0000000..29cb6ca --- /dev/null +++ b/client/src/view/index/Index.scala @@ -0,0 +1,27 @@ +package yoga.view.index + +import scala.xml.Node + +import yoga.model.Pose +import yoga.router.Router +import yoga.service.Poses + +object Index { + + def apply(): Node = + <div class="index__poses"> + {Poses.values.map(renderPose)} + </div> + + def renderPose(pose: Pose): Node = + <a class="index__poseLink" href={Router.Path.licence(pose.image)}> + <div class="index__poseName"> + {pose.name} + </div> + <div class="index__poseImageParent"> + <img class="index__poseImage" src={s"images/${pose.image}"} /> + </div> + </a> + + +} diff --git a/client/src/view/licence/LicencePage.scala b/client/src/view/licence/LicencePage.scala new file mode 100644 index 0000000..fc76522 --- /dev/null +++ b/client/src/view/licence/LicencePage.scala @@ -0,0 +1,24 @@ +package yoga.view.licence + +import java.net.URI +import scala.xml.Node + +import yoga.service.Poses + +object LicencePage { + + def apply(uri: URI): Node = + <div> + {Poses.values.find(_.image == uri).map { pose => + <div> + <div> + <img src={s"images/${pose.image}"} /> + </div> + <a href={pose.rights.licence.uri.toString}> + {pose.rights.licence.name} + </a> + </div> + }} + </div> + +} diff --git a/client/src/view/notFound/NotFound.scala b/client/src/view/notFound/NotFound.scala new file mode 100644 index 0000000..a877640 --- /dev/null +++ b/client/src/view/notFound/NotFound.scala @@ -0,0 +1,12 @@ +package yoga.view.notFound + +import scala.xml.Node + +object NotFound { + + def apply(): Node = + <div> + Page not found + </div> + +} |