Repository navigation
London | 26-ITP-May | Dagim Daniel | Sprint 3 | Quote-generator #1333
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -490,4 +490,24 @@ const quotes = [ | |
| }, | ||
| ]; | ||
|
|
||
| // getting access from the html | ||
| const showquote = document.querySelector("displayArea"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this variable being used? |
||
| const areaOfQuote = document.querySelector("h1"); | ||
| const shufflebutton = document.querySelector("#new-quote"); | ||
| const AreaOfQuoteBy = document.querySelector("h3"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my editor showing me with the same colors to the others
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you using VS Code? On GitHub, this is how they look like: const shufflebutton = document.querySelector("#new-quote");
const AreaOfQuoteBy = document.querySelector("h3");What I wanted to point out is that the naming convention for variables in JS is lower camel case. |
||
|
|
||
| // call pickFromArray with the quotes array to check you get a random quote | ||
|
|
||
| function quoteGenerator() { | ||
| const entireQuote = pickFromArray(quotes); | ||
| const quot = entireQuote.quote; | ||
| const Author = entireQuote.author; | ||
| areaOfQuote.textContent = `" ${quot} "`; | ||
| AreaOfQuoteBy.textContent = `- ${Author}`; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The leading |
||
| } | ||
| //console.log(quoteGenerator); | ||
| //console.log(quot); | ||
| //console.log(Author); | ||
| quoteGenerator(); | ||
| //event handler | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Best practice is to remove all unused code and unnecessary comments to keep the code clean. |
||
| shufflebutton.addEventListener("click", quoteGenerator); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,39 @@ | ||
| /** Write your CSS in here **/ | ||
| .displayArea { | ||
| position: fixed; | ||
| border-style: groove; | ||
| border-top-left-radius: 0%; | ||
| top: 50%; | ||
| left: 50%; | ||
| width: 75%; | ||
| transform: translate(-50%, -50%); | ||
| background-color: whitesmoke; | ||
| } | ||
| body { | ||
| background-color: rgb(223, 208, 182); | ||
| } | ||
| #new-quote { | ||
| border-style: outset; | ||
| font-size: larger; | ||
| color: whitesmoke; | ||
| margin-left: 80%; | ||
| margin-bottom: 10px; | ||
| background-color: rgb(226, 203, 163); | ||
| block-size: 50px; | ||
| } | ||
| #new-quote:hover { | ||
| color: black; | ||
| border-right-width: 10px; | ||
| border-bottom-width: 10px; | ||
| } | ||
|
|
||
| h1 { | ||
| text-align: center; | ||
| margin-right: 20px; | ||
| color: rgb(226, 203, 163); | ||
| } | ||
| h3 { | ||
| text-align: right; | ||
| margin-right: 20px; | ||
| color: rgb(226, 203, 163); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.