-
-
Notifications
You must be signed in to change notification settings - Fork 278
Cape Town | 2026-ITP-Jan | Isaac Abodunrin | Sprint 3 | Grouping data: Quote generator #1181
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
Open
bytesandroses
wants to merge
11
commits into
CodeYourFuture:main
Choose a base branch
from
bytesandroses:coursework/Sprint-3/quote-generator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5e0f94d
Display quotes and authors
bytesandroses 3143a0c
Update title
bytesandroses cff76da
Style text and background color to orange
bytesandroses 57b3587
Style: align quote box to center of page
bytesandroses a9750d1
Style: display and quote on the same line
bytesandroses 2f3c0ca
Style: align quotes to the right
bytesandroses 0b2dfa6
Style: add padding to quotes
bytesandroses 5d9a4f5
Style new quote button
bytesandroses 9e7041b
Style: improve font family
bytesandroses 7360167
Style: improve responsivness
bytesandroses af16855
Style: improve responsivness
bytesandroses File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,18 @@ | ||
| <!DOCTYPE html> | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Title here</title> | ||
| <title>Quote generator app</title> | ||
| <script defer src="quotes.js"></script> | ||
| <link rel="stylesheet" href="style.css" /> | ||
| </head> | ||
| <body> | ||
| <h1>hello there</h1> | ||
| <p id="quote"></p> | ||
| <p id="author"></p> | ||
| <button type="button" id="new-quote">New quote</button> | ||
| <main> | ||
| <h1>"</h1> | ||
| <p id="quote"></p> | ||
| <p id="author"></p> | ||
| <button type="button" id="new-quote">New quote</button> | ||
| </main> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,17 @@ | ||
| const newQuoteButton = document.querySelector("#new-quote"); | ||
|
|
||
| function displayQuote() { | ||
| const randomQuote = pickFromArray(quotes); | ||
| const quote = document.querySelector("#quote"); | ||
| const author = document.querySelector("#author"); | ||
|
|
||
| quote.textContent = randomQuote.quote; | ||
| author.textContent = `- ${randomQuote.author}`; | ||
| } | ||
|
|
||
| newQuoteButton.addEventListener("click", displayQuote); | ||
| window.addEventListener("load", displayQuote); | ||
|
Comment on lines
+12
to
+13
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 code that setup the event listener once is also part of the "run on load" code. For examples, function setup() {
// code to be executed on page load
}
window.addEventListener('load', setup);or window.addEventListener('load', function() {
// code to be executed on page load
}); |
||
|
|
||
| // DO NOT EDIT BELOW HERE | ||
|
|
||
| // pickFromArray is a function which will return one item, at | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,66 @@ | ||
| /** Write your CSS in here **/ | ||
| :root { | ||
| --primary-color: #ffa500; | ||
| --secondary-color: #ffffff; | ||
| } | ||
|
|
||
| * { | ||
| box-sizing: border-box; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| body { | ||
| background-color: var(--primary-color); | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| min-height: 100vh; | ||
| padding: 1rem; | ||
| font-family: | ||
| system-ui, | ||
| -apple-system, | ||
| sans-serif; | ||
| } | ||
|
|
||
| main { | ||
| background-color: var(--secondary-color); | ||
| color: var(--primary-color); | ||
| width: 100%; | ||
| max-width: 850px; | ||
| min-height: 300px; | ||
| padding: clamp(3rem, 6vw, 5rem); | ||
| text-align: right; | ||
| padding: 4rem; | ||
| } | ||
|
|
||
| h1, | ||
| #quote { | ||
| display: inline; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| h1 { | ||
| font-size: clamp(2.5rem, 6vw, 3rem); | ||
| font-family: Theseadow, serif; | ||
| } | ||
|
|
||
| #quote { | ||
| font-size: clamp(1rem, 3vw, 1.5rem); | ||
| } | ||
|
|
||
| #author { | ||
| margin-top: 1rem; | ||
| margin-bottom: 1rem; | ||
| font-style: italic; | ||
| } | ||
|
|
||
| button { | ||
| background-color: var(--primary-color); | ||
| color: var(--secondary-color); | ||
| border: none; | ||
| padding: 0.5rem 1rem; | ||
| cursor: pointer; | ||
| font-weight: bold; | ||
| font-size: large; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The leading
-appears to be for styling purposes. Keeping it in the CSS or in HTML could allow us to adjust the view without changing any JavaScript code.