Skip to content
Closed
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
15 changes: 10 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
<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>
<link rel="stylesheet" href="style.css" />
<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>
<main class="app">
<h1 class="title">Quote Generator</h1>
<div class="card">
<p id="quote" class="quote"></p>
<p id="author" class="author"></p>
<button type="button" id="new-quote" class="btn">New quote</button>
</div>
</main>
</body>
</html>
13 changes: 13 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,16 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
// Grab elements
const quoteEl = document.getElementById("quote");
const authorEl = document.getElementById("author");
const button = document.getElementById("new-quote");

function showQuote() {
const q = pickFromArray(quotes);
quoteEl.textContent = q.quote;
authorEl.textContent = q.author ? `— ${q.author}` : "";
}

button.addEventListener("click", showQuote);
showQuote();
99 changes: 99 additions & 0 deletions Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,100 @@
/** Write your CSS in here **/
:root {
--bg: linear-gradient(135deg,#2e3350,#1c1f2b);
--card-bg: #ffffff;
--accent: #5a48ea;
--accent-hover: #4738ba;
--text-dark: #222;
--text-muted: #555;
--radius: 14px;
--shadow: 0 8px 24px -6px rgba(0,0,0,0.25);
font-family: system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}

* { box-sizing: border-box; }

body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: var(--bg);
color: #fff;
}

.app {
width: 100%;
max-width: 640px;
padding: 2rem 1.5rem 3rem;
text-align: center;
}

.title {
margin: 0 0 1.5rem;
font-size: 2.25rem;
font-weight: 600;
letter-spacing: .5px;
}

.card {
background: var(--card-bg);
color: var(--text-dark);
padding: 2rem 2.2rem;
border-radius: var(--radius);
box-shadow: var(--shadow);
position: relative;
display: flex;
flex-direction: column;
gap: 1.4rem;
}

.quote {
font-size: 1.35rem;
line-height: 1.4;
font-weight: 500;
margin: 0;
position: relative;
}

.quote::before {
content: "“";
font-size: 3.5rem;
line-height: 0.5;
position: absolute;
top: -0.4rem;
left: -0.9rem;
color: var(--accent);
opacity: 0.25;
pointer-events: none;
}

.author {
margin: 0;
font-size: 1rem;
font-style: italic;
color: var(--text-muted);
}

.btn {
align-self: center;
background: var(--accent);
color: #fff;
border: none;
padding: .85rem 1.6rem;
font-size: 1rem;
font-weight: 600;
letter-spacing: .5px;
border-radius: 999px;
cursor: pointer;
transition: background .18s, transform .18s, box-shadow .18s;
box-shadow: 0 4px 14px -4px rgba(90,72,234,.6);
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 10px -4px rgba(90,72,234,.55); }

@media (max-width: 520px) {
.card { padding: 1.6rem 1.4rem; }
.quote { font-size: 1.15rem; }
.title { font-size: 1.9rem; }
}