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
24 changes: 18 additions & 6 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<script defer src="quotes.js"></script>
<title>Quote generator app</title>

<link rel="stylesheet" href="style.css" />

<!-- defer ensures JS loads after the page elements are ready -->
<script src="quotes.js" defer></script>
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<!-- Outer orange container -->
<div class="outer-container">
<!-- Your original title -->
<h1>hello there</h1>

<!-- Inner white card -->
<div class="quote-box">
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,18 @@ const quotes = [
];

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

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

function displayRandomQuote() {
const randomQuote = pickFromArray(quotes);

quoteElement.textContent = randomQuote.quote;
authorElement.textContent = randomQuote.author;
}

displayRandomQuote();

newQuoteButton.addEventListener("click", displayRandomQuote);
83 changes: 82 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,82 @@
/** Write your CSS in here **/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
background-color: #f3a83c;
font-family: Georgia, "Times New Roman", Times, serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}

/* Container for heading + card */
.outer-container {
width: 90%;
max-width: 650px;
text-align: center;
}

/* Heading styling */
h1 {
color: white;
font-family: Arial, sans-serif;
margin-bottom: 20px;
font-size: 28px;
}

/* The white quote card */
.quote-box {
background-color: #ffffff;
padding: 45px;
text-align: left;
position: relative;
}

/* Quote text styling with orange quote mark added automatically */
#quote {
color: #f3a83c;
font-size: 22px;
line-height: 1.4;
margin-bottom: 15px;
}

#quote::before {
content: "“ ";
font-size: 40px;
font-weight: bold;
line-height: 0;
vertical-align: -8px;
}

/* Author text styling right-aligned */
#author {
color: #f3a83c;
font-size: 18px;
text-align: right;
margin-bottom: 25px;
}

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

/* Button styled and pushed to bottom right */
#new-quote {
display: block;
margin-left: auto;
background-color: #f3a83c;
color: #ffffff;
border: none;
padding: 12px 22px;
font-size: 15px;
font-family: Arial, sans-serif;
cursor: pointer;
}

#new-quote:hover {
opacity: 0.9;
}
Loading