-
Notifications
You must be signed in to change notification settings - Fork 0
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
Code review #1
Comments
CSS
|
This is not my area of expertise. My original comment was more in line with using them differently (which would make more sense in a larger project)
|
HTML
JS
|
We can go deeper const showLoadingSpinner = (isHidden) => {
loader.hidden = !isHidden;
quoteContainer.hidden = isHidden;
}; |
Question on IIFE:
|
You wrap your entire script file in the IIFE, not just this function.
If you were to share this script with someone as is, you'd be leaking/potentially-conflicting these variables into the global scope:
If we ignore the DOM selectors at the top for now (we'd refactor this/etc before sharing), you'd still have 5 javascript variable/function definitions with not-very-unique names that have a high chance of conflicting with other scripts on a page. By wrapping it in an IIFE, the code still gets executed but in the If you read the section on the module pattern, it might make more sense about how the variables are accessible within that function, but not to outsiders who try to access the "private variables" like |
CSS
auto
the default value? => quote-generator/css/style.css Line 83 in a449eaa width: auto; #2quote-generator/css/reset.css
Line 38 in a449eaa
--space
is not defined? =>quote-generator/css/style.css
Line 43 in a449eaa
quote-generator/css/style.css
Line 67 in a449eaa
data-type
attribute and targeting that just for styling, I'd say thedata-long
is OK, butdata-type
isn't... also see below, maybe using custom data attribute isn't needed =>quote-generator/css/style.css
Line 130 in a449eaa
1024px
is a more common breakpoint for tablet~ but this is up2u =>quote-generator/css/style.css
Line 143 in a449eaa
--10px
are descriptive, but maybe not canonical~ usually you'd make them prescriptive names: Heading, Subhead, Body, ... There's nothing to change, but to keep in mind for future referenceHTML
quote-generator/index.html
Line 3 in a449eaa
Javascript
quote-generator/script.js
Line 15 in a449eaa
${error}
), instead omit that from the template literal and log it instead =>quote-generator/script.js
Line 31 in a449eaa
newQuote
IMO. You could make a transition method with a timer, but as it is now, it "doesn't do anything" because the next quote is instant =>quote-generator/script.js
Line 37 in a449eaa
??
, if you're into that =>quote-generator/script.js
Line 44 in a449eaa
toggle
maybe instead , 50/50 =>quote-generator/script.js
Line 51 in a449eaa
Overall
.textContent
to avoid xss =>quote-generator/script.js
Line 58 in a449eaa
The text was updated successfully, but these errors were encountered: