mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Update layout and CSS
This commit is contained in:
parent
a50b12b0ea
commit
a05d4ad2e3
@ -16,7 +16,8 @@ h4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2em;
|
font-size: 1.6em;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
18
assets/css/_nav.scss
Normal file
18
assets/css/_nav.scss
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,4 +4,5 @@
|
|||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
@import "layout";
|
@import "layout";
|
||||||
|
@import "nav";
|
||||||
@import "board";
|
@import "board";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<h2>Game with <%= opponent(@conn, @game).name %></h2>
|
|
||||||
|
|
||||||
<p><%= link "Back to games", to: game_path(@conn, :index) %></p>
|
<p><%= link "Back to games", to: game_path(@conn, :index) %></p>
|
||||||
|
|
||||||
|
<h2>Game with <%= opponent(@conn, @game).name %></h2>
|
||||||
|
|
||||||
<div id="app" data-game-id="<%= @game.id %>">
|
<div id="app" data-game-id="<%= @game.id %>">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -12,29 +12,35 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<header role="banner">
|
||||||
<header role="banner">
|
<div class="container">
|
||||||
<nav role="user">
|
<h1>Chess</h1>
|
||||||
|
|
||||||
|
<nav class="user-nav" role="user">
|
||||||
<%= if current_user(@conn) do %>
|
<%= if current_user(@conn) do %>
|
||||||
<%= current_user(@conn).name %> (<%= current_user(@conn).email %>)
|
<%= current_user(@conn).name %> (<%= current_user(@conn).email %>)
|
||||||
|
|
|
|
||||||
<%= link("Log out", to: session_path(@conn, :delete), method: :delete) %>
|
<%= link("Log out", to: session_path(@conn, :delete), method: :delete) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link("Register", to: registration_path(@conn, :new)) %>
|
<%= link("Register", to: registration_path(@conn, :new)) %>yout
|
||||||
|
|
|
|
||||||
<%= link("Log in", to: session_path(@conn, :new)) %>
|
<%= link("Log in", to: session_path(@conn, :new)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</nav>
|
</nav>
|
||||||
<h1>Chess</h1>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<div class="container alerts">
|
||||||
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
||||||
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<main role="main">
|
<main role="main">
|
||||||
|
<div class="container">
|
||||||
<%= render @view_module, @view_template, assigns %>
|
<%= render @view_module, @view_template, assigns %>
|
||||||
</main>
|
</div>
|
||||||
</div> <!-- /container -->
|
</main>
|
||||||
|
|
||||||
<script src="<%= static_path(@conn, "/js/vendor.js") %>"></script>
|
<script src="<%= static_path(@conn, "/js/vendor.js") %>"></script>
|
||||||
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
|
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
<h2>Welcome</h2>
|
<h2>Welcome</h2>
|
||||||
|
|
||||||
<p>Sign in or register to get started.</p>
|
<p><%= link("Log in", to: session_path(@conn, :new)) %> or <%= link("Register", to: registration_path(@conn, :new)) %> to get started.</p>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ defmodule Chess.RegistrationTest do
|
|||||||
test "user can register", %{session: session} do
|
test "user can register", %{session: session} do
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> visit("/")
|
||||||
|> click(link("Register"))
|
|> click(css(".user-nav a", text: "Register"))
|
||||||
|> fill_in(text_field("Name"), with: "Link")
|
|> fill_in(text_field("Name"), with: "Link")
|
||||||
|> fill_in(text_field("Email"), with: "link@example.com")
|
|> fill_in(text_field("Email"), with: "link@example.com")
|
||||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
|> 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
|
test "user cannot register without a name", %{session: session} do
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> visit("/")
|
||||||
|> click(link("Register"))
|
|> click(css(".user-nav a", text: "Register"))
|
||||||
|> fill_in(text_field("Email"), with: "link@example.com")
|
|> fill_in(text_field("Email"), with: "link@example.com")
|
||||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||||
|> click(button("Register"))
|
|> click(button("Register"))
|
||||||
@ -32,7 +32,7 @@ defmodule Chess.RegistrationTest do
|
|||||||
test "user cannot register without an email", %{session: session} do
|
test "user cannot register without an email", %{session: session} do
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> visit("/")
|
||||||
|> click(link("Register"))
|
|> click(css(".user-nav a", text: "Register"))
|
||||||
|> fill_in(text_field("Name"), with: "Link")
|
|> fill_in(text_field("Name"), with: "Link")
|
||||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||||
|> click(button("Register"))
|
|> click(button("Register"))
|
||||||
@ -46,7 +46,7 @@ defmodule Chess.RegistrationTest do
|
|||||||
test "user cannot register without a password", %{session: session} do
|
test "user cannot register without a password", %{session: session} do
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> visit("/")
|
||||||
|> click(link("Register"))
|
|> click(css(".user-nav a", text: "Register"))
|
||||||
|> fill_in(text_field("Name"), with: "Link")
|
|> fill_in(text_field("Name"), with: "Link")
|
||||||
|> fill_in(text_field("Email"), with: "link@example.com")
|
|> fill_in(text_field("Email"), with: "link@example.com")
|
||||||
|> click(button("Register"))
|
|> click(button("Register"))
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
defmodule Chess.SessionTest do
|
defmodule Chess.SessionTest do
|
||||||
use ChessWeb.FeatureCase
|
use ChessWeb.FeatureCase
|
||||||
|
|
||||||
import Wallaby.Query, only: [text_field: 1, link: 1, button: 1]
|
import Wallaby.Query
|
||||||
import Chess.Factory
|
import Chess.Factory
|
||||||
|
|
||||||
test "user cannot log in with incorrect email", %{session: session} do
|
test "user cannot log in with incorrect email", %{session: session} do
|
||||||
@ -9,7 +9,7 @@ defmodule Chess.SessionTest do
|
|||||||
|
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> 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("Email"), with: "link@example.com")
|
||||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||||
|> click(button("Log in"))
|
|> click(button("Log in"))
|
||||||
@ -22,7 +22,7 @@ defmodule Chess.SessionTest do
|
|||||||
|
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> 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("Email"), with: "link@hyrule.kingdom")
|
||||||
|> fill_in(text_field("Password"), with: "calamityganon")
|
|> fill_in(text_field("Password"), with: "calamityganon")
|
||||||
|> click(button("Log in"))
|
|> click(button("Log in"))
|
||||||
@ -35,7 +35,7 @@ defmodule Chess.SessionTest do
|
|||||||
|
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> 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("Email"), with: "link@hyrule.kingdom")
|
||||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||||
|> click(button("Log in"))
|
|> click(button("Log in"))
|
||||||
@ -50,7 +50,7 @@ defmodule Chess.SessionTest do
|
|||||||
|
|
||||||
session
|
session
|
||||||
|> visit("/")
|
|> 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("Email"), with: "link@hyrule.kingdom")
|
||||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||||
|> click(button("Log in"))
|
|> click(button("Log in"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user