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
7 changes: 4 additions & 3 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<!DOCTYPE html>
<!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>
<title>Quote generator app</title>
<link rel="icon" href="" />
<link rel="stylesheet" href="./style.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>
Expand Down
13 changes: 13 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,16 @@ const quotes = [
];

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

function displayQuote() {
const randomQuote = pickFromArray(quotes);
const quoteElement = document.getElementById("quote");
const authorElement = document.getElementById("author");

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

displayQuote();

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

body {
background-color: #f5a742;
font-family: Georgia, serif;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 40px;
}

#quote {
background-color: white;
padding: 80px 60px 40px;
margin: 0;
font-size: 2.5rem;
color: #f5a742;
line-height: 1.5;
position: relative;
max-width: 1200px;
width: 100%;
}

#quote::before {
content: '"';
font-size: 5rem;
left: 30px;
top: 10px;
font-weight: bold;
line-height: 1;
}

#author {
background-color: white;
padding: 20px 60px 80px;
margin: 0;
text-align: right;
font-size: 1.5rem;
color: #f5a742;
max-width: 1200px;
width: 100%;
position: relative;
}

#new-quote {
position: absolute;
bottom: 30px;
right: 60px;
background-color: #f5a742;
color: white;
border: none;
padding: 15px 35px;
font-size: 1.1rem;
cursor: pointer;
font-family: sans-serif;
}

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