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
12 changes: 10 additions & 2 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
<!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>
<script defer src="quotes.js"></script>
<script defer src="script.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>hello there</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<label>
<input type="checkbox" id="auto-toggle" />
Auto-play
</label>

<p id="auto-status"></p>
</body>
</html>
31 changes: 31 additions & 0 deletions Sprint-3/quote-generator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const quoteP = document.querySelector("#quote");
const authorP = document.querySelector("#author");
const newQuoteBtn = document.querySelector("#new-quote");

function displayRandomQuote() {
const randomQuote = pickFromArray(quotes);
quoteP.innerText = randomQuote.quote;
authorP.innerText = randomQuote.author;
}

window.addEventListener("load", () => {
displayRandomQuote();
});

newQuoteBtn.addEventListener("click", () => {
displayRandomQuote();
});

let intervalId = null;
const autoToggle = document.querySelector("#auto-toggle");
const autoStatus = document.querySelector("#auto-status");

autoToggle.addEventListener("change", () => {
if (autoToggle.checked) {
autoStatus.innerText = "auto-play:ON";
intervalId = setInterval(displayRandomQuote, 5000); // 5 seconds for testing
} else {
autoStatus.innerText = "auto-play:OFF";
clearInterval(intervalId);
}
});
70 changes: 69 additions & 1 deletion 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;
padding: 0;
font-family: "Segoe UI", sans-serif;
background: linear-gradient(135deg, #4b79a1, #283e51);
color: white;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}

/* Quote box */
.quote-box {
background: rgba(255, 255, 255, 0.1);
padding: 30px 40px;
border-radius: 12px;
max-width: 600px;
backdrop-filter: blur(8px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
animation: fadeIn 0.8s ease;
}

/* Quote text */
#quote {
font-size: 1.6rem;
margin-bottom: 20px;
line-height: 1.4;
}

/* Author */
#author {
font-size: 1.2rem;
opacity: 0.8;
}

/* Button */
#new-quote {
margin-top: 30px;
padding: 12px 25px;
font-size: 1rem;
border: none;
border-radius: 8px;
background: #ffcc00;
color: #333;
cursor: pointer;
transition:
transform 0.2s ease,
background 0.3s ease;
}

#new-quote:hover {
background: #ffdb4d;
transform: scale(1.05);
}

/* Fade animation */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
Loading