Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<title>Quote Generator</title>

<!-- CONNECT YOUR CSS HERE -->
<link rel="stylesheet" href="style.css" />

<!-- YOUR JS FILE -->
<script defer src="quotes.js"></script>
</head>

<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>

<div id="quote-container">
<p id="quote"></p>
<p id="author"></p>
<button id="new-quote">New quote</button>
</div>
Comment on lines 15 to 19
Copy link

Choose a reason for hiding this comment

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

You're using <p> tags for both quote and author. Could there be more semantic HTML elements that better describe the content?

Copy link
Author

Choose a reason for hiding this comment

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

I have added a different tag please review.

Copy link

Choose a reason for hiding this comment

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

nice one, blockquote works for the quote itself, look into the tag that is suitable for author.

Copy link
Author

Choose a reason for hiding this comment

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

I have decided to use cite tag for Author

Copy link

Choose a reason for hiding this comment

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

Awesome, that resolves this issue

</body>
</html>

28 changes: 28 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
// Show a random quote on the screen
function showRandomQuote() {
// Get one random object from the quotes array
const randomQuote = pickFromArray(quotes);

// Find the HTML elements
const quoteElement = document.getElementById("quote");
const authorElement = document.getElementById("author");

// Put the text inside the page
quoteElement.textContent = `"${randomQuote.quote}"`;
authorElement.textContent = `— ${randomQuote.author}`;
}

// This runs when the page loads
function setup() {
// Show the first random quote
showRandomQuote();

// When button is clicked → show another quote
const button = document.getElementById("new-quote");
button.addEventListener("click", showRandomQuote);
}

// Make sure setup runs after page loads
window.onload = setup;


// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
67 changes: 67 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
/** Write your CSS in here **/
/* Page background */
body {
margin: 0;
padding: 0;
background-color: #f19d17; /* light orange color */
font-family: Georgia, "Times New Roman", serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

/* Center white box */
#quote-container {
background: white;
padding: 60px 80px;
width: 70%;
max-width: 900px;
border-radius: 4px;
text-align: left;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Quote text */
#quote {
font-size: 2rem;
color: #fdc682; /* matching orange tone */
font-weight: normal;
line-height: 1.5;
margin-bottom: 40px;
position: relative;
padding-left: 50px;
}

/* Big quotation mark style */
#quote::before {
content: "❝";
font-size: 3rem;
color: #f4b48a;
position: absolute;
left: 0;
top: -10px;
}

/* Author text */
#author {
text-align: right;
font-size: 1.2rem;
color: #ed8208;
margin-bottom: 40px;
}

/* Button styling */
#new-quote {
background-color: #a0e0ed;
color: rgb(146, 160, 185);
padding: 12px 30px;
border: none;
border-radius: 3px;
font-size: 1rem;
cursor: pointer;
float: right;
}

#new-quote:hover {
background-color: #cf7f22;
}