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
9 changes: 7 additions & 2 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
<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="stylesheet" href="style.css" />
<script defer src="quotes.js"></script>
</head>
<body>
<h1>hello there</h1>
<div class="page-wrapper">
<h1>Your Quote for the day</h1>
<div class="quote-container">
<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 @@ -490,4 +490,19 @@ const quotes = [
},
];

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

document.getElementById("quote").textContent = randomQuote.quote;
document.getElementById("author").textContent = randomQuote.author;
}

// A new quote is shown on page load
displayRandomQuote();

//Button click
document
.getElementById("new-quote")
.addEventListener("click", displayRandomQuote);

// call pickFromArray with the quotes array to check you get a random quote
68 changes: 68 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
/** Write your CSS in here **/
body {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
background-color: #f59e0b;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
/* h1 changes */
h1 {
color: #050301;
text-align: center;
margin-bottom: 40px;
font-weight: normal;
}

/* Container card */
.quote-container {
background-color: #d9d9d9;
width: 70%;
max-width: 800px;
padding: 60px;
box-sizing: border-box;
text-align: left;
}

/* Quote text */
#quote {
font-size: 32px;
color: #f59e0b;
line-height: 1.4;
margin-bottom: 30px;
position: relative;
}

/* Big quote mark */
#quote::before {
content: "“";
font-size: 80px;
position: absolute;
left: -40px;
top: -20px;
color: #f59e0b;
}

/* Author */
#author {
text-align: right;
font-size: 20px;
color: #130d04;
margin-bottom: 30px;
}

/* Button */
#new-quote {
float: right;
background-color: #f59e0b;
color: white;
border: none;
padding: 15px 25px;
font-size: 16px;
cursor: pointer;
}

#new-quote:hover {
background-color: #d97706;
}
Loading