-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.jsx
62 lines (55 loc) · 1.32 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Libraries
import React from "react";
import CurrencyFormat from "react-currency-format";
// Styles
import { Background } from "./charity.style";
const Charity = ({ index, item, deleteChar }) => {
const del = () => {
deleteChar(item.id);
};
console.log(item.id);
return (
<Background isHeader={index === -1}>
<p>{item.organization}</p>
<p>{item.hashtag}</p>
{index === -1 ? (
<p>{item.amount}</p>
) : (
<CurrencyFormat
value={item.amount}
displayType={"text"}
thousandSeparator={true}
prefix={"$"}
renderText={(value) => <p>{value}</p>}
/>
)}
{index === -1 ? (
<p>{item.limit}</p>
) : (
<CurrencyFormat
value={item.limit}
displayType={"text"}
thousandSeparator={true}
prefix={"$"}
renderText={(value) => <p>{value}</p>}
/>
)}
{!(index === -1) && (
<p>
<button
onClick={() => {
window.open(item.website, "_blank");
}}
>
Donate!
</button>
<button onClick={del} style={{ marginLeft: "0.5rem" }}>
X
</button>
</p>
)}
{index === -1 && <p></p>}
</Background>
);
};
export default Charity;