-
Notifications
You must be signed in to change notification settings - Fork 8
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
Default UI for /hoodie/account
#75
Conversation
Tests are failing due to #3, you can ignore them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handler: function (request, reply) { | ||
reply.file(path.join(__dirname, '..', 'public', 'client.js')) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of defining separate paths for each static asset, let’s use inert to server all assets from the public/
folder at the /
root path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll use inert. Any hoodie repository already using inert? Might help me a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we use inert in the main hoodie
repository to serve static assets from the Hoodie app’s public/
folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the three reply.file
statements, you can do
server.route({
method: 'GET',
path: '/{p*}',
handler: {
directory: {
path: path.join(__dirname, '..', 'public'),
listing: false,
index: true
}
}
})
and adjust the paths of <script src="/default/js/default.js"></script>
and <link rel="stylesheet" href="/default/css/default.css">
to ./client.js
and ./client.css
Open browser console and play with <code>hoodie.account</code>. | ||
</p> | ||
<div class="generic-loader-wrap"></div> | ||
<script src="/default/js/default.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put all the HTML into index.html already, and just toggle it depending on the user’s state. Check out this account.html file from hoodie-app-tracker. It has a data-account-state=""
property on the <body>
tag, we set / change the state in common.js and we use the html attribute in CSS to toggle content in app.css
That helps a lot with a cleaner separation of content (HTML) and behavior (JS)
Hope that makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gr2m my current implementation is better is my opinion as it helps reduce the DOM by controlling DOM manipulations through JS.
HTML is JS has faced a lot of apprehension but it is gaining a lot of acceptance lately due to React with it's JSX Syntactic Sugar.
I seriously feel that it would be easier to maintain the code using my approach, although if you do think I should follow the approach given in hoodie-app-tracker, I'll do it.
Please let me know what you think is best. I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A big objective for us is the accessibility and contributor-friendlyness of Hoodie’s code base. I agree that React and virtual DOM is fascinating, but it’s not solving problems that we have right now :) The simpler we can keep it, the better, so I’d rather like to follow the old-school approach and just use HTML and toggle content with JavaScript for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright!
border-radius: 50%; | ||
} | ||
.generic-loader-wrap:before { | ||
content: url(http://hoodiehq.github.io/hoodie-css/src/content_img/animals/low-profile-dog-1.png); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once we use inert (see comment below), let’s put this image into the public/
folder and load it with a relative path. We try avoiding loading assets from URLs to make sure that the apps work when run locally, even when not connected to the internet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gr2m can you have a look at the html and js file now?
I've separated the html from the js file. Please comment so that I may continue finishing this up. Thanks!
margin-left: -30px; | ||
margin-top: -40px; | ||
color: #FFF; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make sure each set of rules are separated with a linebreak please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Charlotteis sure! Must have missed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the empty lines and see my other comment. Otherwise it’s looking good 👍
|
||
<div data-hide="false" class="generic-loader-wrap"></div> | ||
|
||
<div data-hide="true" class="input-forms"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than divs, which give no semantic indication of what the sections are, would section
be better here for each of the 'Sign In', 'Sign Up, 'Sign Out', 'Update Account', 'Destroy' etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow how using section
might be better here. Can you explain it a bit? I can always add an id
attribute to each component in the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all sections of content, so sections seems to make sense.
I try not to use div
wherever possible as div
is not very semantic HTML.
http://html5doctor.com/lets-talk-about-semantics/ might explain better.
a better question might be, why don't you think we should use them? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Charlotteis semantically speaking, I think I get your point. I'll make the relevant changes soon.
handler: function (request, reply) { | ||
reply.file(path.join(__dirname, '..', 'public', 'client.js')) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the three reply.file
statements, you can do
server.route({
method: 'GET',
path: '/{p*}',
handler: {
directory: {
path: path.join(__dirname, '..', 'public'),
listing: false,
index: true
}
}
})
and adjust the paths of <script src="/default/js/default.js"></script>
and <link rel="stylesheet" href="/default/css/default.css">
to ./client.js
and ./client.css
@@ -3,11 +3,47 @@ | |||
<head> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add lang="en"
to the <html>
tag above?
<div data-hide="false" class="generic-loader-wrap"></div> | ||
|
||
<section data-hide="true" class="input-forms"> | ||
<h3>Sign In</h3><br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the first header on the page, this should not be an h3.
Headings should not be used for decoration, they are important for content navigation.
So, the first heading on a page should be an H1.
Perhaps we can have an H1 heading of "Account" and then all the h3's can be h2 subheadings?
|
||
<section data-hide="true" class="input-forms"> | ||
<h3>Sign In</h3><br> | ||
<input name="login-username-field" type="text" placeholder="Username"><br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add labels to all form inputs, it's more accessible. Placeholders dissapear on focus.
01f7be0
to
94ef6de
Compare
@gr2m @Charlotteis please have a look at the new commits |
<label>USERNAME</label><br> | ||
<input name="login-username-field" type="text"><br> | ||
<label>PASSWORD</label><br> | ||
<input name="login-password-field" type="password"><br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two things:
- avoid using uppercase only text because screen readers will read it out letter by letter, you can use css for that (
text-transform: uppercase
) - add the
for
attribute to labels andid
attributes to the respective inputs, with same values, e.g.
<label for="login-username-field">Username</label><br>
<input name="username" type="text" id="login-username-field"><br>
I think it's done now. Please let me know the same 😛 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me now, thanks! Ping @Charlotteis
Great work @mbad0la! |
I will fix the CI errors and merge 👍 |
Great! Thanks for being so patient 🙂 |
One thing that totally slipped in my review is that you used arrow functions in |
Oh, so sorry for that, didn't know about it and it has become kind of a reflex to write arrow functions :p |
I know, same here :) no worries at all |
This is in reference to hoodiehq/camp#22
Work in Progress