Skip to content
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
18 changes: 13 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
<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>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
<div class="page">
<main class="quote-card">
<figure class="quote">
<span class="quote-mark">❝</span>
<blockquote id="quote-text"></blockquote>
<figcaption id="quote-author"></figcaption>
</figure>

<button id="new-quote-btn" type="button">New quote</button>
</main>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,10 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
function generateRandomQuote(){
const myObj =pickFromArray(quotes);
document.getElementById("quote-text").textContent=`${myObj.quote}`
document.getElementById("quote-author").textContent=`-${myObj.author}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could consider placing the - part (a piece of static content) in HTML or inserted via CSS.

}
window.onload=generateRandomQuote;
document.getElementById("new-quote-btn").addEventListener("click",generateRandomQuote);
71 changes: 70 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
/** Write your CSS in here **/

* {
box-sizing: border-box;
}

body {
margin: 0;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, sans-serif;
background-color: #f2a634;

}


.page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}

.quote-card {
background-color: #ffffff;
max-width: 900px;
width: 90%;
padding: 4rem 5rem;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.quote {
margin: 0 0 3rem 0;
position: relative;
color: #f2a634;
}

.quote-mark {
font-size: 4rem;
line-height: 1;
display: inline-block;
margin-right: 0.75rem;
vertical-align: top;
}

blockquote {
display: inline;
font-size: 2rem;
font-weight: 500;
color: #f2a634;
}


figcaption {
margin-top: 2rem;
text-align: right;
font-size: 1.1rem;
color: #f2a634;
}

#new-quote-btn {
display: inline-block;
margin-left: auto;
padding: 0.9rem 2.4rem;
font-size: 1rem;
border: none;
background-color: #f2a634;
color: #ffffff;
cursor: pointer;
text-transform: none;
}

Loading