diff --git a/assets/css/_layout.scss b/assets/css/_layout.scss index 8c68ca8..26a22bc 100644 --- a/assets/css/_layout.scss +++ b/assets/css/_layout.scss @@ -16,7 +16,8 @@ h4 { } h1 { - font-size: 2em; + font-size: 1.6em; + margin: 0; } .container { diff --git a/assets/css/_nav.scss b/assets/css/_nav.scss new file mode 100644 index 0000000..409067d --- /dev/null +++ b/assets/css/_nav.scss @@ -0,0 +1,18 @@ +header[role='banner'] { + background: $black; + margin-bottom: 1em; + padding: 0.5em 0; + + .container { + display: flex; + } + + h1 { + flex: 0; + } + + nav.user-nav { + flex: 1; + text-align: right; + } +} diff --git a/assets/css/app.scss b/assets/css/app.scss index 9162824..88f336f 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -4,4 +4,5 @@ @import "variables"; @import "layout"; +@import "nav"; @import "board"; diff --git a/lib/chess_web/templates/game/show.html.eex b/lib/chess_web/templates/game/show.html.eex index 51199a9..0402355 100644 --- a/lib/chess_web/templates/game/show.html.eex +++ b/lib/chess_web/templates/game/show.html.eex @@ -1,6 +1,6 @@ -

Game with <%= opponent(@conn, @game).name %>

-

<%= link "Back to games", to: game_path(@conn, :index) %>

+

Game with <%= opponent(@conn, @game).name %>

+
diff --git a/lib/chess_web/templates/layout/app.html.eex b/lib/chess_web/templates/layout/app.html.eex index 8071437..e25af48 100644 --- a/lib/chess_web/templates/layout/app.html.eex +++ b/lib/chess_web/templates/layout/app.html.eex @@ -12,29 +12,35 @@ -
-
-
+ +
+
-
+
+
<%= render @view_module, @view_template, assigns %> -
- + +
+ diff --git a/lib/chess_web/templates/page/index.html.eex b/lib/chess_web/templates/page/index.html.eex index 2a2d35c..d3832e2 100644 --- a/lib/chess_web/templates/page/index.html.eex +++ b/lib/chess_web/templates/page/index.html.eex @@ -1,3 +1,3 @@

Welcome

-

Sign in or register to get started.

+

<%= link("Log in", to: session_path(@conn, :new)) %> or <%= link("Register", to: registration_path(@conn, :new)) %> to get started.

diff --git a/test/features/registration_test.exs b/test/features/registration_test.exs index 0f1d081..89c02f0 100644 --- a/test/features/registration_test.exs +++ b/test/features/registration_test.exs @@ -6,7 +6,7 @@ defmodule Chess.RegistrationTest do test "user can register", %{session: session} do session |> visit("/") - |> click(link("Register")) + |> click(css(".user-nav a", text: "Register")) |> fill_in(text_field("Name"), with: "Link") |> fill_in(text_field("Email"), with: "link@example.com") |> fill_in(text_field("Password"), with: "ilovezelda") @@ -18,7 +18,7 @@ defmodule Chess.RegistrationTest do test "user cannot register without a name", %{session: session} do session |> visit("/") - |> click(link("Register")) + |> click(css(".user-nav a", text: "Register")) |> fill_in(text_field("Email"), with: "link@example.com") |> fill_in(text_field("Password"), with: "ilovezelda") |> click(button("Register")) @@ -32,7 +32,7 @@ defmodule Chess.RegistrationTest do test "user cannot register without an email", %{session: session} do session |> visit("/") - |> click(link("Register")) + |> click(css(".user-nav a", text: "Register")) |> fill_in(text_field("Name"), with: "Link") |> fill_in(text_field("Password"), with: "ilovezelda") |> click(button("Register")) @@ -46,7 +46,7 @@ defmodule Chess.RegistrationTest do test "user cannot register without a password", %{session: session} do session |> visit("/") - |> click(link("Register")) + |> click(css(".user-nav a", text: "Register")) |> fill_in(text_field("Name"), with: "Link") |> fill_in(text_field("Email"), with: "link@example.com") |> click(button("Register")) diff --git a/test/features/session_test.exs b/test/features/session_test.exs index fb733d6..3deac03 100644 --- a/test/features/session_test.exs +++ b/test/features/session_test.exs @@ -1,7 +1,7 @@ defmodule Chess.SessionTest do use ChessWeb.FeatureCase - import Wallaby.Query, only: [text_field: 1, link: 1, button: 1] + import Wallaby.Query import Chess.Factory test "user cannot log in with incorrect email", %{session: session} do @@ -9,7 +9,7 @@ defmodule Chess.SessionTest do session |> visit("/") - |> click(link("Log in")) + |> click(css(".user-nav a", text: "Log in")) |> fill_in(text_field("Email"), with: "link@example.com") |> fill_in(text_field("Password"), with: "ilovezelda") |> click(button("Log in")) @@ -22,7 +22,7 @@ defmodule Chess.SessionTest do session |> visit("/") - |> click(link("Log in")) + |> click(css(".user-nav a", text: "Log in")) |> fill_in(text_field("Email"), with: "link@hyrule.kingdom") |> fill_in(text_field("Password"), with: "calamityganon") |> click(button("Log in")) @@ -35,7 +35,7 @@ defmodule Chess.SessionTest do session |> visit("/") - |> click(link("Log in")) + |> click(css(".user-nav a", text: "Log in")) |> fill_in(text_field("Email"), with: "link@hyrule.kingdom") |> fill_in(text_field("Password"), with: "ilovezelda") |> click(button("Log in")) @@ -50,7 +50,7 @@ defmodule Chess.SessionTest do session |> visit("/") - |> click(link("Log in")) + |> click(css(".user-nav a", text: "Log in")) |> fill_in(text_field("Email"), with: "link@hyrule.kingdom") |> fill_in(text_field("Password"), with: "ilovezelda") |> click(button("Log in"))