Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

WM5 | Ahmadzay Bahadory | MODULE-JS-2 | QUOTES GENERATORS | WEEK 3 #97

Open
wants to merge 3 commits 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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions week-1/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ To run tests in the `week-1` directory you can:

1. Change directory into `week-1`
2. Run the tests using `npm test`

## Fix

Expand Down
17 changes: 12 additions & 5 deletions week-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
<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 class="quote-Content">
<div class="quote-wrapper">
<p id="quote"></p>
<p class="quote-mark">"</p>
</div>
<dive class="btn-wrapper">
<p id="author"></p>
<button type="button" id="new-quote">New quote</button>
</dive>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions week-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,18 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote

function displayQuotes() {
const randomQuote = pickFromArray(quotes);
// calling pickFromArray() function withe parameter array quotes.
document.getElementById("quote").textContent = randomQuote.quote;
// getting HTML p tag id "quote" to assign its text content to quotes array's
document.getElementById("author").textContent = `- ${randomQuote.author}`;
}

// call the function when the page load
window.onload = displayQuotes;

// add event listener to the new quote button
//let myDive = document.getElementById("myContent");
document.getElementById("new-quote").addEventListener("click", displayQuotes);
54 changes: 54 additions & 0 deletions week-3/quote-generator/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
/** Write your CSS in here **/
/** Write your CSS in here **/
body {
background-color: orange;
}
.quote-Content {
background-color: white;
margin: 6rem 5rem;
padding: 1rem;
}
.quote-mark {
color: orange;
font-size: 8rem;
margin-top: 5.5rem;
padding: 1rem;
}
.quote-wrapper {
display: flex;
align-items: center;
flex-direction: row-reverse;
margin-top: 1rem;
}

#quote {
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
color: orange;
font-size: 40px;
margin-right: 2rem;
margin-left: 1rem;
}
#author {
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
color: orange;
font-size: 40px;
}
#new-quote {
padding: 22px 25px;
background-color: orange;
font-size: 20px;
color: white;
font-weight: 200;
border: none;
}
.btn-wrapper {
display: flex;
flex-direction: column;
align-items: end;
margin-right: 1rem;
}

/* #new-quote {
background-color: aquamarine;
padding: 1rem 0rem 1rem 0rem;
margin: 1rem 1rem 1rem 95rem;
} */