-
-
Notifications
You must be signed in to change notification settings - Fork 326
London | 26-ITP-May | Chinwe Chukwuma | Sprint 3 | Quote generator #1355
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
ChinweP
wants to merge
18
commits into
CodeYourFuture:main
Choose a base branch
from
ChinweP:module-data-groups/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
18 commits
Select commit
Hold shift + click to select a range
7d8f402
Fix calculateMedian implementation so it passes all tests
ChinweP 4649963
Add dedupe implementation that passes all current tests
ChinweP bb247fd
Implement findMax and add full test coverage for all input scenarios
ChinweP 816b104
Implement sum function and add full test coverage
ChinweP 64a2b80
Refactor includes to use a for-of loop
ChinweP b057112
Fix address lookup by using correct object property
ChinweP c76ea74
Fix object iteration by using Object.values() instead of for-of
ChinweP 1743311
Add correct ingredient logging by looping through recipe.ingredients
ChinweP 5ee5409
Add jest tests covering all contains() acceptance criteria
ChinweP 03c6296
Fix invert function and add tests for key-value swapping
ChinweP f9dccd9
Update title element in `index.html` .
ChinweP 5eb32ce
Add script.js file for quote generator logic
ChinweP 7df982f
Add script.js to index.html so quote generator logic loads correctly
ChinweP c23f133
Add styling to quote generator
ChinweP beeca1c
Fix revert files from Sprint 1
ChinweP 5e2db2b
fix revert files in Sprint-1
ChinweP 2fdbb0a
fix remove changes to Sprint-2 files
ChinweP 10273ee
Refactor quote generator: move event listeners into onload and replac…
ChinweP 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,23 @@ | ||
| <!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> | ||
| <script defer src="script.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> | ||
| <label> | ||
| <input type="checkbox" id="auto-toggle" /> | ||
| Auto-play | ||
| </label> | ||
|
|
||
| <p id="auto-status"></p> | ||
| </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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| const quoteP = document.querySelector("#quote"); | ||
| const authorP = document.querySelector("#author"); | ||
| const newQuoteBtn = document.querySelector("#new-quote"); | ||
| const autoToggle = document.querySelector("#auto-toggle"); | ||
| const autoStatus = document.querySelector("#auto-status"); | ||
|
|
||
| const AUTO_PLAY_INTERVAL = 5000; | ||
| let intervalId = null; | ||
|
|
||
| function displayRandomQuote() { | ||
| const randomQuote = pickFromArray(quotes); | ||
| quoteP.innerText = randomQuote.quote; | ||
| authorP.innerText = randomQuote.author; | ||
| } | ||
|
|
||
| window.addEventListener("load", () => { | ||
| displayRandomQuote(); | ||
|
|
||
| newQuoteBtn.addEventListener("click", displayRandomQuote); | ||
|
|
||
| autoToggle.addEventListener("change", () => { | ||
| if (autoToggle.checked) { | ||
| autoStatus.innerText = "auto-play:ON"; | ||
| intervalId = setInterval(displayRandomQuote, AUTO_PLAY_INTERVAL); // 5 seconds for testing | ||
| } else { | ||
| autoStatus.innerText = "auto-play:OFF"; | ||
| clearInterval(intervalId); | ||
| } | ||
| }); | ||
| }); | ||
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,69 @@ | ||
| /** Write your CSS in here **/ | ||
| body { | ||
| margin: 0; | ||
| padding: 0; | ||
| font-family: "Segoe UI", sans-serif; | ||
| background: linear-gradient(135deg, #4b79a1, #283e51); | ||
| color: white; | ||
| height: 100vh; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| text-align: center; | ||
| } | ||
|
|
||
| /* Quote box */ | ||
| .quote-box { | ||
| background: rgba(255, 255, 255, 0.1); | ||
| padding: 30px 40px; | ||
| border-radius: 12px; | ||
| max-width: 600px; | ||
| backdrop-filter: blur(8px); | ||
| box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); | ||
| animation: fadeIn 0.8s ease; | ||
| } | ||
|
|
||
| /* Quote text */ | ||
| #quote { | ||
| font-size: 1.6rem; | ||
| margin-bottom: 20px; | ||
| line-height: 1.4; | ||
| } | ||
|
|
||
| /* Author */ | ||
| #author { | ||
| font-size: 1.2rem; | ||
| opacity: 0.8; | ||
| } | ||
|
|
||
| /* Button */ | ||
| #new-quote { | ||
| margin-top: 30px; | ||
| padding: 12px 25px; | ||
| font-size: 1rem; | ||
| border: none; | ||
| border-radius: 8px; | ||
| background: #ffcc00; | ||
| color: #333; | ||
| cursor: pointer; | ||
| transition: | ||
| transform 0.2s ease, | ||
| background 0.3s ease; | ||
| } | ||
|
|
||
| #new-quote:hover { | ||
| background: #ffdb4d; | ||
| transform: scale(1.05); | ||
| } | ||
|
|
||
| /* Fade animation */ | ||
| @keyframes fadeIn { | ||
| from { | ||
| opacity: 0; | ||
| transform: translateY(10px); | ||
| } | ||
| to { | ||
| opacity: 1; | ||
| transform: translateY(0); | ||
| } | ||
| } |
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.
If needed, this comment would be better placed where the variable is declared.