Initial CSS setup

This commit is contained in:
Trevor Vallender 2023-08-18 17:20:31 +01:00
parent f20d267707
commit 4307f6182c
6 changed files with 186 additions and 25 deletions

View File

@ -0,0 +1,49 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

View File

@ -0,0 +1,116 @@
:root {
--border-color: gray;
--highlight-color: #D36200;
--background-color: #CECECE;
--dark-background-color: #3A3A3A;
--inset-background-color: #FFFFFF;
}
* {
box-sizing: border-box;
}
body {
font-size: 1.2em;
font-family: sans-serif;
background-color: var(--background-color);
}
h1, h2, h3, h4, h5, h6, h7 {
font-weight: bold;
padding: .5em 0;
}
h1 {
font-size: 4em;
text-align: center;
color: var(--highlight-color);
-webkit-text-stroke: 1px var(--background-color);
}
h2 {
font-size: 2.5em;
}
header {
background-color: var(--dark-background-color);
}
nav {
padding: 1em;
> ul {
text-align: center;
> li {
display: inline;
padding: 0 2em;
> a:link, > a:visited {
text-decoration: none;
font-size: 1.3em;
font-weight: bold;
}
> a:hover {
text-decoration: underline;
}
}
}
}
a:link, a:visited {
color: var(--highlight-color);
}
a:hover {
text-decoration: none;
}
main {
padding: 1em;
}
form {
display: grid;
grid-template-columns: 1fr 2fr;
gap: .5em;
align-items: center;
max-width: 35em;
margin: 0 auto;
border: 1px solid var(--border-color);
border-radius: .5em;
font-size: 1.2em;
background-color: var(--inset-background-color);
box-shadow: .5em .5em 3em var(--dark-background-color);
> label {
grid-column: 1;
text-align: right;
margin: 0 .1em 1em .5em;
}
> input {
font-size: 1em;
grid-column: 2;
padding: .25em;
margin: 0 .5em 1em .1em;
}
> input[type=submit] {
grid-column: 1/3;
margin: 0 .5em 1em .5em;
background-color: var(--highlight-color);
border: 1px solid var(--border-color);
border-radius: .25em;
}
> input[type=text]:focus, > input[type=password]:focus, > textarea:focus {
box-shadow: 0 0 10px var(--highlight-color);
}
> h2 {
text-align: center;
font-size: 1.5em;
background-color: var(--highlight-color);
grid-column: 1/3;
border-radius: .2em .2em 0 0;
}
}

View File

@ -11,19 +11,21 @@
</head> </head>
<body> <body>
<h1>Summon Player</h1> <header>
<nav> <h1>Summon Player</h1>
<ul> <nav>
<li><%= link_to t("home"), root_path %></li> <ul>
<% if logged_in? %> <li><%= link_to t("home"), root_path %></li>
<li><%= link_to t("profile"), user_path(current_user) %></li> <% if logged_in? %>
<li><%= link_to t("log_out"), log_out_path, data: { turbo_method: :delete } %></li> <li><%= link_to t("profile"), user_path(current_user) %></li>
<% else %> <li><%= link_to t("log_out"), log_out_path, data: { turbo_method: :delete } %></li>
<li><%= link_to t("log_in"), new_session_path %></li> <% else %>
<li><%= link_to t("register"), new_user_path %></li> <li><%= link_to t("log_in"), new_session_path %></li>
<% end %> <li><%= link_to t("register"), new_user_path %></li>
</ul> <% end %>
</nav> </ul>
</nav>
</header>
<main> <main>
<% flash.each do |type, msg| %> <% flash.each do |type, msg| %>
<div class="flash"> <div class="flash">

View File

@ -1,6 +1,6 @@
<%= t ".log_in" %>
<%= form_with url: sessions_path, method: :post do |f| %> <%= form_with url: sessions_path, method: :post do |f| %>
<h2><%= t ".log_in" %></h2>
<%= f.label :username %> <%= f.label :username %>
<%= f.text_field :username %> <%= f.text_field :username %>

View File

@ -1,5 +1,5 @@
<%= form_with model: @user do |f| %> <%= form_with model: @user do |f| %>
<h2><%= t(".register") %></h2>
<%= f.label :username %> <%= f.label :username %>
<%= f.text_field :username %> <%= f.text_field :username %>

View File

@ -1,5 +1,6 @@
require_relative "boot" # frozen_string_literal: true
require_relative "boot"
require "rails/all" require "rails/all"
# Require the gems listed in Gemfile, including any gems # Require the gems listed in Gemfile, including any gems
@ -8,15 +9,8 @@ Bundler.require(*Rails.groups)
module SummonPlayer module SummonPlayer
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0 config.load_defaults 7.0
# Configuration for the application, engines, and railties goes here. config.time_zone = "London"
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
end end
end end