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
16 changes: 11 additions & 5 deletions Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
<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>
<div id="quote-card">
<div id="card-header">
<img id="profile-pic" src="tumblrprofile.jpg" alt="Profile picture">
<p id="username">waakeme--upp</p>
</div>
<p id="quote"></p>
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</div>
</body>
</html>
6 changes: 5 additions & 1 deletion Sprint-3/quote-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
"bugs": {
"url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
},
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme"
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme",
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1",
"jest-environment-jsdom": "^30.5.2"
}
}
16 changes: 16 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,19 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
function displayRandomQuote(){
const randomQuote = pickFromArray(quotes); // this is an object
// display text
let quoteDisplay = document.getElementById("quote")
quoteDisplay.textContent = `"${randomQuote.quote}"`

let authorDisplay = document.getElementById("author")
authorDisplay.textContent = `- ${randomQuote.author}`
}

// display quote on load
displayRandomQuote()

// button should recall pickFromArray
let newQuoteButton = document.getElementById("new-quote")
newQuoteButton.addEventListener('click', displayRandomQuote)
80 changes: 79 additions & 1 deletion Sprint-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,79 @@
/** Write your CSS in here **/
/** Write your CSS in here
quote p ==== id='quote'
author p === id='author'
button === id='new-quote'
**/

body {
background-image: url('tumblrbgimg.jpeg');
background-size: contain;
background-position: center;
background-repeat: no-repeat;
background-color: #023647;
color: #030303;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;

}

#quote-card {
backdrop-filter:blur(10px);
background-color: rgb(255, 255, 255);
border-radius: 10px;
padding: 20px 20px;
max-width: 350px;
}

#card-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 15px;
}

#profile-pic {
width: 30px;
height: 30px;
object-fit: cover;
}

#quote {
font-family: sans-serif;
line-height: 1.4;
font-style: italic;
word-spacing: -1.5px
}

#author {
color: #555;
font-size: 11px;
font-weight: bold;
}

#new-quote {
display: block;
margin-left: auto;
margin-top: 20px;
background-color: #333;
color: white;
border: none;
border-radius: 20px;
padding: 8px, 16px;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How does the browser interpret padding: 8px, 16px on the button?

To "like" or "dislike" this comment, please follow this link

font-size: 12px;
font-weight: bold;
font-family: sans-serif;
cursor: pointer;
}

#username {
font-weight: bold;
font-size: 13px;
margin: 0;
}




Binary file added Sprint-3/quote-generator/tumblrbgimg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sprint-3/quote-generator/tumblrprofile.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading