Skip to content

IPT JAN 25 | Katarzyna Kazimierczuk | Data Groups | Sprint 3 - quote qenerator #504

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</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>
<div id="container">
<h1 id="greeting">Check out your quote of the day</h1>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>

<script src="quotes.js"></script>
</body>
</html>
17 changes: 17 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
const quote = document.getElementById("quote");
const author = document.getElementById("author");
const button = document.getElementById("new-quote");

// generate and show to user
const generateQuote = () => {
const selectedQuote = pickFromArray(quotes);
quote.innerHTML = selectedQuote.quote;
author.innerHTML = selectedQuote.author;
// change greeting
document.getElementById("greeting").innerHTML = "Your quote is:";
document.getElementById("greeting").style = "size: 1rem";
};

//show to user on click of new quote
button.addEventListener("click", generateQuote);

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
51 changes: 50 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
/** Write your CSS in here **/
html {
background-color: aliceblue;
display: flex;
justify-content: center;
align-items: center;
}

#container {
background-color: #e0fff8aa;
padding: 20px;
border-radius: 5px;
border: solid 1px #75758d;
box-shadow: 0px 0px 3px #b1b1b8;
margin-top: 3rem;
max-width: 600px;
}

#greeting {
font-size: 2rem;
color: #4a4a4a;
font-weight: 600;
}

#quote {
font-size: 1.5rem;
color: #4a4a4a;
font-weight: 400;
font-style: italic;
}

#author {
font-size: 1rem;
color: #676767;
font-weight: 300;
}

button {
background-color: #4a4a4a;
color: white;
padding: 10px 20px;
border-radius: 12px;
font-size: 1rem;
cursor: pointer;
font-weight: 500;
margin-top: 1rem;
}

button:hover {
background-color: #050404;
}