Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 7 additions & 4 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Title here</title>
<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 class="box">
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
</body>
</html>
16 changes: 16 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,19 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote

const author = document.querySelector("#author");
const quote = document.querySelector("#quote");
const newQuoteButton = document.querySelector("#new-quote");

displayQuote();

newQuoteButton.addEventListener("click", () => {
displayQuote();
});

function displayQuote() {
const randomQuote = pickFromArray(quotes);
quote.textContent = randomQuote.quote;
author.textContent = randomQuote.author;
}
49 changes: 48 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
/** Write your CSS in here **/
body {
font-family: Arial, Helvetica, sans-serif;
min-height: 100vh;
margin: 0;
display: flex;
padding: 0 1rem;
background-color: #F59E25;
}

.box {
max-width: 700px;
margin: auto;
background-color: #FFFFFF;
border-radius: 8px;
padding: 2rem;
text-align: center;
}

h1 {
margin-bottom: 2rem;
}

#quote {
font-size: 1.5rem;
font-style: italic;
line-height: 1.6;
margin-bottom: 1rem;
}

#author {
font-size: 1.1rem;
font-weight: bold;
margin-bottom: 2rem;
}

button {
padding: 0.75rem 1.5rem;
font-size: 1rem;
cursor: pointer;
border: none;
border-radius: 6px;
background-color: #1976d2;
color: white;
}

button:hover {
background-color: #1565c0;
}
Loading