Skip to content

Glasgow | ITP May 25 | Mirabelle Morah | Module Data Groups | Sprint 3 | Quote Generator #606

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
24 changes: 19 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<title>Quotes</title>
<script defer src="quotes.js"></script>
<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>
<section>
<h1>Quote generator</h1>

<h3 id="quote-text">
The best opportunities don’t often come from joining the crowd but
serving it
</h3>

<p id="quote-author">JM Marco</p>
</section>

<footer>
<p id="new-quote">🔄</p>
</footer>

<!-- <script src="script.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

function showNewQuote() {
const randomQuote = pickFromArray(quotes);
document.getElementById("quote-text").textContent = randomQuote.quote;
document.getElementById("quote-author").textContent =
"- " + randomQuote.author;
}

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

// Show one on load
showNewQuote();
53 changes: 52 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
/** Write your CSS in here **/
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");

body {
font-family: "Inter", sans-serif;
line-height: 1.3;
color: #333;
background-color: #faa209;
background-image: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0));
/* 180deg is the same as to bottom, direction, color */
margin: 0 auto;
max-width: 620px;
padding: 20px;
height: 100vh;
transition: all 0.5s;
}

section {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
overflow: hidden;
}

h1 {
color: #333;
font-size: 5vmin; /* 10% of the minimum (height or) viewport width of the browser*/
margin-bottom: 20px;
font-weight: 500;
}

h3 {
font-size: 5vmin;
font-weight: 300;
}

footer {
display: flex;
font-size: 5vmin;
justify-content: center;
position: fixed;
width: 100%;
bottom: 10%;
left: 0;
cursor: pointer;
transition: all 1s;
}

footer:hover {
transform: scale(0.7);
}