Skip to content

Cape Town | 2026-ITP-Jan | Isaac Abodunrin | Sprint 3 | Grouping data: Quote generator#1181

Open
bytesandroses wants to merge 14 commits intoCodeYourFuture:mainfrom
bytesandroses:coursework/Sprint-3/quote-generator
Open

Cape Town | 2026-ITP-Jan | Isaac Abodunrin | Sprint 3 | Grouping data: Quote generator#1181
bytesandroses wants to merge 14 commits intoCodeYourFuture:mainfrom
bytesandroses:coursework/Sprint-3/quote-generator

Conversation

@bytesandroses
Copy link
Copy Markdown
Member

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

  • Created a responsive quote generator webpage styled using quote_generator_example.png as a guide.
  • When the page loads (or the New quotes button pressed), a quote is randomly selected and the following is displayed:
    • Quote
    • Author
    • New quote button

@bytesandroses bytesandroses added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 5, 2026
const author = document.querySelector("#author");

quote.textContent = randomQuote.quote;
author.textContent = `- ${randomQuote.author}`;
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right -- removing the - from JavaScript would be better for separation of concerns. I've moved the - into the CSS. I've also moved the leading in front of each quote from the HTML into the CSS so it's more consistent.

Comment on lines +12 to +13
newQuoteButton.addEventListener("click", displayQuote);
window.addEventListener("load", displayQuote);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.
You can consider including all the "run on load" code in a function to make it clearer
that "this is what runs when the page loads."

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
});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion CJ. I've gone ahead and wrapped the code needed to run on loading into a setup function.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 9, 2026
@bytesandroses bytesandroses added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 9, 2026
@cjyuan
Copy link
Copy Markdown
Contributor

cjyuan commented Apr 9, 2026

Looks good. Well done.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants