aboutsummaryrefslogtreecommitdiff
path: root/client/src/view
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/view')
-rw-r--r--client/src/view/View.scala22
-rw-r--r--client/src/view/index/Index.scala27
-rw-r--r--client/src/view/licence/LicencePage.scala24
-rw-r--r--client/src/view/notFound/NotFound.scala12
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>
+
+}