Skip to content

Commit d1e20a2

Browse files
author
Derek Roode
committed
quote atom made
1 parent c511061 commit d1e20a2

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, { useEffect } from "react";
2+
import styles from "./Quote.module.css";
3+
4+
function Quote() {
5+
const [quote, setQuote] = useState("");
6+
7+
useEffect(() => {
8+
getQuote();
9+
}, []);
10+
11+
//get quote
12+
async function getQuote() {
13+
const response = await fetch("https://type.fit/api/quotes/");
14+
const data = await response.json();
15+
let pos = Math.floor(Math.random() * (1642 - 0));
16+
17+
setQuote(`${data[pos].text} - ${data[pos].author}`);
18+
}
19+
20+
return (
21+
<div className={styles.quote_of_the_day}>
22+
<h2>{quote}</h2>
23+
</div>
24+
);
25+
}
26+
27+
export default Quote;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.quote_of_the_day {
2+
text-align: center;
3+
color: #777e90;
4+
width: 100%;
5+
max-height: 80px;
6+
padding: 0 20px;
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react'
2+
3+
function Main() {
4+
return (
5+
<div>
6+
7+
</div>
8+
)
9+
}
10+
11+
export default Main

react-app/src/components/Pages/Main/Main.module.css

Whitespace-only changes.

0 commit comments

Comments
 (0)