Skip to content
Closed
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
27 changes: 15 additions & 12 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<!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>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quote generator app</title>
<link rel="stylesheet" href="styles.css">
<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>
</body>
</html>
</head>
<body>
<div class="container">
<h1>Quote generator</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
</body>
</html>
26 changes: 26 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,29 @@ const quotes = [
];

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


function displayRandomQuote() {
const random = pickFromArray(quotes);
const quoteEl = document.getElementById("quote");
const authorEl = document.getElementById("author");

if (quoteEl) quoteEl.textContent = random.quote;
if (authorEl) authorEl.textContent = random.author;
}

function displayRandomQuote() {
const random = pickFromArray(quotes);
const quoteEl = document.getElementById("quote");
const authorEl = document.getElementById("author");

if (quoteEl) quoteEl.textContent = random.quote;
if (authorEl) authorEl.textContent = random.author;
}

displayRandomQuote();

const newQuoteBtn = document.getElementById("new-quote");
if (newQuoteBtn) {
newQuoteBtn.addEventListener("click", displayRandomQuote);
}
1 change: 0 additions & 1 deletion Sprint-3/quote-generator/style.css

This file was deleted.

70 changes: 70 additions & 0 deletions Sprint-3/quote-generator/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: orange;
}

.container {
background-color: white;
font-size: large;
padding: 40px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
max-width: 500px;
width: 90%;
position: relative;
min-height: 300px;
margin: 0;
}

h1 {
color: #333;
margin-bottom: 30px;
font-size: 1.8em;
text-align: center;
}

#quote {
font-size: 1.3em;
line-height: 1.6;
margin-bottom: 20px;
color: orange;
font-weight: normal;
}

#quote::before, #quote::after {
content: '“';
font-size: 1.5em;
vertical-align: top;
}

#author {
font-size: 1.1em;
color: orange;
position: absolute;
bottom: 70px;
right: 40px;
margin: 0;
text-align: right;
}

#author::before {
content: "- ";
}

#new-quote {
background-color: orange;
color: white;
border: none;
padding: 8px 16px;
font-size: 0.9em;
border-radius: 4px;
cursor: pointer;
font-family: Arial, sans-serif;
position: absolute;
bottom: 30px;
right: 40px;
}