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
15 changes: 15 additions & 0 deletions Prep/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "prep",
"version": "1.0.0",
"description": "",
"main": "mean.js",
"scripts": {
"test": "jest"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jest": "^30.2.0"
}
}
15 changes: 10 additions & 5 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>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<h1>Quote Generator</h1>
<p id="quote">Loading...</p>
<p id="author">Author will appear here.</p>
<button id="new-quote">New Quote</button>

<label for="auto-play-toggle">Auto-play: </label>
<input type="checkbox" id="auto-play-toggle" />
<span id="auto-play-status">OFF</span>
</body>
</html>
37 changes: 37 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
function pickRandomQuote() {
return pickFromArray(quotes);
}

function displayQuote() {
const randomQuote = pickRandomQuote();
console.log("Displaying Quote:", randomQuote);
document.getElementById("quote").innerText = randomQuote.quote;
document.getElementById("author").innerText = randomQuote.author;
}

let autoPlayInterval;

function toggleAutoPlay() {
const autoPlayStatus = document.getElementById("auto-play-status");
const isChecked = document.getElementById("auto-play-toggle").checked;
if (isChecked) {
autoPlayStatus.innerText = "ON";

autoPlayInterval = setInterval(displayQuote, 5000);
} else {
autoPlayStatus.innerText = "OFF";

clearInterval(autoPlayInterval);
}
}

document.addEventListener("DOMContentLoaded", function () {
document.getElementById("new-quote").addEventListener("click", displayQuote);
document
.getElementById("auto-play-toggle")
.addEventListener("change", toggleAutoPlay);

// Initially display a quote
displayQuote();
});

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
104 changes: 103 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,103 @@
/** Write your CSS in here **/
body {
font-family: "Roboto", sans-serif;
text-align: center;
margin: 0;
padding: 0;
background: linear-gradient(135deg, #f7c5d6, #c6f7ff);
color: #333;
}

h1 {
color: #5e5e5e;
font-size: 3.5em;
margin-top: 40px;
font-weight: 600;
letter-spacing: 2px;
}

#quote-box {
background-color: #ffffff;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
padding: 40px;
max-width: 700px;
margin: 50px auto;
text-align: center;
color: #444;
transition: transform 0.3s ease-in-out, box-shadow 0.3s ease;
}

#quote-box:hover {
transform: translateY(-10px);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

#quote {
font-size: 2.2em;
font-weight: bold;
color: #333;
margin-bottom: 30px;
font-style: italic;
line-height: 1.5;
}

#author {
font-size: 1.3em;
color: #888;
margin-top: 20px;
font-weight: 500;
letter-spacing: 1px;
}

button {
font-size: 1.2em;
padding: 15px 30px;
background-color: #ff7c84;
color: white;
border: none;
border-radius: 30px;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
margin-top: 30px;
}

button:hover {
background-color: #f6b0b8;
transform: translateY(-5px);
}

#auto-play-toggle {
margin-top: 20px;
width: 50px;
height: 25px;
border-radius: 15px;
background-color: #ddd;
position: relative;
transition: background-color 0.3s ease;
}

#auto-play-toggle:checked {
background-color: #4caf50;
}

#auto-play-status {
font-weight: bold;
margin-left: 10px;
font-size: 1.1em;
color: #333;
font-family: "Roboto", sans-serif;
}

.toggle-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 30px;
}

.container {
width: 100%;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}