Skip to content

London | 25-ITP-May |Khilola Rustamova | Sprint 3 | Quote-generator #640

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 3 commits 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
7 changes: 5 additions & 2 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
<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>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>hello there</h1>
<h1 id="greating">Hello there</h1>
<div class="quote-box">
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
</body>
</html>
8 changes: 8 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
function pickFromArray(choices) {
return choices[Math.floor(Math.random() * choices.length)];
}
function displayQuote() {
const randomQuote = pickFromArray(quotes);
document.getElementById("quote").innerText = randomQuote.quote;
document.getElementById("author").innerText = randomQuote.author;
}

document.getElementById("new-quote").addEventListener("click", displayQuote);

window.onload = displayQuote;
// A list of quotes you can use in your app.
// DO NOT modify this array, otherwise the tests may break!
const quotes = [
Expand Down
71 changes: 71 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,72 @@
/** Write your CSS in here **/
/* Overall background */
body {
background-color: #f4a42c; /* orange background */
font-family: 'Georgia', serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

/* White box around quote */
.quote-box {
background-color: white;
padding: 40px;
border: 3px solid #f4a42c; /* orange border */
border-radius: 8px;
max-width: 700px;
text-align: center;
box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
}

/* Greating text */
#greating {
font-size: 1.8rem;
font-family: 'Georgia', serif;
text-align: center;
color: #f0ece7; /* orange text */
margin-bottom: 800px; }

/* Quote text */
#quote {
font-size: 1.8rem;
font-family: 'Cursive', serif;
text-align: right;
color: #f4a42c; /* orange text */
margin-bottom: 20px;
}

/* Author text */
#author {
font-size: 1.2rem;
font-family: 'Georgia', serif;
color: #f4a42c; /* orange text */
text-align: right;
margin-bottom: 30px;
}

/* Button */
#new-quote {
background-color: #f4a42c;
color: white;
border: none;
padding: 10px 20px;
font-size: 1rem;
cursor: pointer;
border-radius: 4px;
transition: background-color 0.3s ease;
}

#new-quote:hover {
background-color: #d68f27;
}

#quote::before {
content: "“"; /* Large opening quote */
font-size: 3rem;
vertical-align: top;
color: #f4a42c; /* Match your orange theme */
margin-right: 10px;
display: inline-block;}