Skip to content

London | 25-ITP-May | Hendrine Zeraua | Sprint 3 | Quote Generator App #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
34 changes: 22 additions & 12 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
<!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>
<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>
</body>

<head>
<meta charset="UTF-8" />
<title>Quote Generator app </title>
<link rel="stylesheet" href="style.css" />
</head>

<body>
<div id="quote"></div>
<div id="author"></div>
<button id="new-quote">New quote</button>


<script src="quotes.js"></script>
<script>
window.onload = () => {
showRandomQuote();
document.getElementById("new-quote").addEventListener("click", showRandomQuote);
};
</script>
</body>

</html>
6 changes: 6 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
function showRandomQuote() {
const quote = pickFromArray(quotes);
document.getElementById("quote").textContent = `"${quote.quote}"`;
document.getElementById("author").textContent = `— ${quote.author}`;
}

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
66 changes: 65 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
/** Write your CSS in here **/
body {
margin: 0;
font-family: 'Georgia', serif;
background-color: #f0f4f8;
/* soft blue-gray */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.quote-box {
background-color: white;
padding: 2rem 3rem;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
max-width: 600px;
width: 90%;
text-align: left;
position: relative;
}

#quote {
font-size: 1.5rem;
color: #1a4d6e;
/* deep blue */
margin-bottom: 1.5rem;
position: relative;
}

#quote::before {
content: "“";
font-size: 3rem;
color: #479696;
/* teal accent */
position: absolute;
left: -1.5rem;
top: -1rem;
}

#author {
text-align: right;
color: #479696;
/* teal author */
font-style: italic;
font-size: 1rem;
margin-bottom: 1rem;
}

#new-quote {
background-color: #479696;
/* teal button */
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 4px;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s;
}

#new-quote:hover {
background-color: #3a7c7c;
/* darker teal */ }