Skip to content

Manchester | 25-ITP-May | Jennifer Isidienu | Sprint 3 | Quote Generator #782

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
16 changes: 10 additions & 6 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
<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>
<title>Quote generator app</title>
<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>
<h1>Quote generator app</h1>
<p>Click the button to get a new quote.</p>
<div>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
<script defer src="quotes.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,15 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
let quote = document.getElementById("quote");
let author = document.getElementById("author");
let quoteButton = document.getElementById("new-quote");

function displayQuote() {
let randomQuote = pickFromArray(quotes);
quote.textContent = randomQuote.quote;
author.textContent = randomQuote.author;
}

displayQuote();
quoteButton.addEventListener("click", displayQuote);
42 changes: 42 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
/** Write your CSS in here **/
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 50px auto;
padding: 0 20px;
background: #198699;
color: #333;
text-align: center;
}

h1 {
margin-bottom: 10px;
}

#quote {
font-size: 1.5rem;
font-weight: bold;
margin: 20px 0 5px 0;
color: #b0b7be;
}

#author {
font-size: 1.2rem;
font-style: italic;
margin-bottom: 30px;
color: #7f8c8d;
}

button#new-quote {
background-color: #101a20;
border: none;
padding: 10px 20px;
font-size: 1rem;
color: white;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}

button#new-quote:hover {
background-color: #43494d;
}