Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bit of styling and rewording #86

Open
wants to merge 6 commits into
base: something-tracker
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 101 additions & 15 deletions www/assets/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
html {
box-sizing: border-box;
font-size: 16px;
color: #222;
}

*, *:after, *:before {
Expand All @@ -21,7 +22,12 @@ h1, h4 {

h1 {
border-bottom: 2px solid #222;
text-align: left;
line-height: 1.5;
}

textarea {
height: 3.25em;
max-width: 100%;
}

/* Layout */
Expand All @@ -44,6 +50,16 @@ h1 {
margin-right: 1rem;
}

/* Clearfix */
.grid > .grid-col:before,
.grid > .grid-col:after {
content: " ";
display: table;
}
.grid > .grid-col:after {
clear: both;
}

@media (min-width: 768px) {
.grid > .grid-col {
float: left;
Expand All @@ -53,26 +69,90 @@ h1 {

/* Components */

.form-label,
.form-input,
.table {
width: 100%;
margin-bottom: 1rem;
}

.form-input {
padding: 1rem;
}

.form-label {
display: inline-block;
font-weight: bold;
display: inline-block;
font-weight: bold;
}

.btn {
display: inline-block;
padding: 1rem;
margin-bottom: 1rem;
border-radius: 5px;
background: #CCC;
border: none;
}

.btn + .btn-small {
margin-left: .5rem;
}

.form-label-small,
.form-input-small,
.btn-small {
font-size: .8rem;
}

.form-input-small,
.btn-small {
padding: .5rem;
}

.form-label,
.form-input,
.textarea,
.table {
width: 100%;
margin-bottom: 1rem;
}

.form-input,
.table {
border: 1px solid #aaa;
}

.table th:first-child{
width: 20%;
}

.btn:focus,
.form-input:focus {
border-color: transparent;
outline: none;
box-shadow: 0 0 0 2px #222;
}

/* Clearfix */
.form:before,
.form:after {
content: " ";
display: table;
}
.form:after {
clear: both;
}


@media (min-width: 768px) {
.form-inline .form-label,
.form-inline .form-input {
display: inline-block;
width: auto;
}

.form-inline .form-input-small {
margin-left: .5rem;
margin-right: .5rem;
}
.form-inline .form-label-small {
padding-top: .5rem;
padding-bottom: .5rem;
margin-bottom: 0;
}
}

.table {
Expand All @@ -82,6 +162,13 @@ h1 {
.table th,
.table td {
padding: 1rem;
text-align: left;
}

.table th:first-child,
.table td:first-child {
padding: 1rem;
text-align: right;
}

.table td {
Expand All @@ -98,6 +185,10 @@ h1 {
text-align: center;
}

.text-right {
text-align: right;
}

.pull-right {
float: right;
}
Expand All @@ -107,8 +198,3 @@ h1 {
width: 100%;
}
}

#login-form {
text-align: right;
padding-bottom: 2rem;
}
32 changes: 16 additions & 16 deletions www/assets/app.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
var $loginForm = document.querySelector('#login-form')
var $loggedinMessage = document.querySelector('#loggedin-message')
var $registerButton = document.querySelector('#button-register')
var $logoutButton = document.querySelector('#button-logout')
var $signinForm = document.querySelector('.js-signin-form')
var $signedinMessage = document.querySelector('.js-signedin-message')
var $signupButton = document.querySelector('.js-signup-btn')
var $signoutButton = document.querySelector('.js-signout-btn')

var $trackerForm = document.querySelector('.js-tracker-input')
var $trackerOutput = document.querySelector('.js-tracker-output')
var $trackerClearButton = document.querySelector('.js-tracker-clear')

$loginForm.addEventListener('submit', function (event) {
$signinForm.addEventListener('submit', function (event) {
event.preventDefault()

var username = $loginForm.querySelector('[name=username]').value
var password = $loginForm.querySelector('[name=password]').value
var username = $signinForm.querySelector('[name=username]').value
var password = $signinForm.querySelector('[name=password]').value

hoodie.account.signIn({
username: username,
Expand All @@ -23,11 +23,11 @@ $loginForm.addEventListener('submit', function (event) {
})
})

$registerButton.addEventListener('click', function (event) {
$signupButton.addEventListener('click', function (event) {
event.preventDefault()

var username = $loginForm.querySelector('[name=username]').value
var password = $loginForm.querySelector('[name=password]').value
var username = $signinForm.querySelector('[name=username]').value
var password = $signinForm.querySelector('[name=password]').value

hoodie.account.signUp({
username: username,
Expand All @@ -46,7 +46,7 @@ $registerButton.addEventListener('click', function (event) {
})
})

$logoutButton.addEventListener('click', function (event) {
$signoutButton.addEventListener('click', function (event) {
event.preventDefault()

hoodie.account.signOut()
Expand Down Expand Up @@ -123,17 +123,17 @@ function addNote (note) {

function showSignedIn (username) {
document.querySelector('.js-username').textContent = username
$loggedinMessage.style.display = 'block'
$loginForm.style.display = 'none'
$signedinMessage.classList.remove('hide');
$signinForm.classList.add('hide');
}

function hideSignedIn () {
$loggedinMessage.style.display = 'none'
$loginForm.style.display = 'block'
$signedinMessage.classList.add('hide');
$signinForm.classList.remove('hide');
}

hoodie.account.on('signin', function (account) {
$loginForm.reset()
$signinForm.reset()
showSignedIn(account.username)
})
hoodie.account.on('signout', hideSignedIn)
Expand Down
Loading