1
0
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:
Daniel Barber 2018-03-05 10:19:47 -05:00
parent a50b12b0ea
commit a05d4ad2e3
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
8 changed files with 48 additions and 22 deletions

View File

@ -16,7 +16,8 @@ h4 {
}
h1 {
font-size: 2em;
font-size: 1.6em;
margin: 0;
}
.container {

18
assets/css/_nav.scss Normal file
View 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;
}
}

View File

@ -4,4 +4,5 @@
@import "variables";
@import "layout";
@import "nav";
@import "board";

View File

@ -1,6 +1,6 @@
<h2>Game with <%= opponent(@conn, @game).name %></h2>
<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>

View File

@ -12,29 +12,35 @@
</head>
<body>
<div class="container">
<header role="banner">
<nav role="user">
<div class="container">
<h1>Chess</h1>
<nav class="user-nav" role="user">
<%= if current_user(@conn) do %>
<%= current_user(@conn).name %> (<%= current_user(@conn).email %>)
|
<%= link("Log out", to: session_path(@conn, :delete), method: :delete) %>
<% else %>
<%= link("Register", to: registration_path(@conn, :new)) %>
<%= link("Register", to: registration_path(@conn, :new)) %>yout
|
<%= link("Log in", to: session_path(@conn, :new)) %>
<% end %>
</nav>
<h1>Chess</h1>
</div>
</header>
<div class="container alerts">
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
</div>
<main role="main">
<div class="container">
<%= render @view_module, @view_template, assigns %>
</div>
</main>
</div> <!-- /container -->
<script src="<%= static_path(@conn, "/js/vendor.js") %>"></script>
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
</body>

View File

@ -1,3 +1,3 @@
<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>

View File

@ -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"))

View File

@ -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"))