-
-
Notifications
You must be signed in to change notification settings - Fork 211
Glasgow | 25-ITP-Sep | Abraham-Habte | Sprint 3| Quote_Generator_App #853
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
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 |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
|
|
||
|
|
||
|
|
||
| // DO NOT EDIT BELOW HERE | ||
|
|
||
| // pickFromArray is a function which will return one item, at | ||
|
|
@@ -14,6 +17,7 @@ | |
| // Examples of use | ||
| // --------------- | ||
| // pickFromArray(['a','b','c','d']) // maybe returns 'c' | ||
|
|
||
|
|
||
| // You don't need to change this function | ||
| function pickFromArray(choices) { | ||
|
|
@@ -491,3 +495,17 @@ const quotes = [ | |
| ]; | ||
|
|
||
| // call pickFromArray with the quotes array to check you get a random quote | ||
| let randomQuote = pickFromArray(quotes); | ||
| console.log(randomQuote); // maybe logs { quote: "...", author: "..." } | ||
|
||
|
|
||
| const quoteElement = document.getElementById("quote"); | ||
| const authorElement = document.getElementById("author"); | ||
| const newquoteButton = document.getElementById("new-quote"); | ||
|
|
||
| function displayRandomQuote() { | ||
|
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. Having a function where you can fetch a quote and update your DOM is good, as it improves code readability and quality. Well-done!
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. got it |
||
| const randomQuote = pickFromArray(quotes); | ||
| quoteElement.innerText = `"${randomQuote.quote}"`; | ||
| authorElement.innerText = `- ${randomQuote.author}`; | ||
|
||
| } | ||
| displayRandomQuote(); | ||
| newquoteButton.addEventListener("click", displayRandomQuote); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,47 @@ | ||
| /** Write your CSS in here **/ | ||
| body { | ||
| margin: 0; | ||
| height: 100vh; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| background: #4244c7; | ||
| font-family: Arial, sans-serif; | ||
| } | ||
| .greeting { | ||
| color: #fff; | ||
| margin-bottom: 50px; | ||
| font-size: 24px; | ||
| } | ||
| .quote-box { | ||
| background: #f0f0f0; | ||
| padding: 20px 30px; | ||
| border-radius: 10px; | ||
| text-align: center; | ||
| box-shadow: 0 4px 8px rgba(0,0,0,0.1); | ||
| } | ||
|
|
||
| blockquote { | ||
| margin: 0 0 10px; | ||
| font-size: 28px; | ||
| color: #080706c7; | ||
| font-style: italic; | ||
| font-weight: bold; | ||
| } | ||
| .author { | ||
| margin: 0 0 15px; | ||
| color: #1d0daf; | ||
| font-size: 20px; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| .btn { | ||
| background: #4244c7; | ||
| color: #fff; | ||
| border: none; | ||
| padding: 8px 16px; | ||
| border-radius: 20px; | ||
| cursor: pointer; | ||
| } | ||
| .btn:hover { background: #eb2f48; } |
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.
Nice job using the blockquote. Is there better html semantic to denote the author?