-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDynamic-Greeting-Cards.html
99 lines (96 loc) · 2.37 KB
/
Dynamic-Greeting-Cards.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dynamic Greeting Cards</title>
<style>
#container {
display: grid;
margin-left: 30px;
grid-template-columns: repeat(3, 1fr);
gap: 30px;
& > .card {
width: 90%;
text-align: center;
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
border-radius: 8px;
& span {
color: tomato;
}
& > img {
width: 100%;
}
}
}
</style>
</head>
<body>
<div id="root"></div>
</body>
<script src="https://www.unpkg.com/react@18.2.0/umd/react.development.js"></script>
<script src="https://www.unpkg.com/react-dom@18.2.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel">
// Your code will go here
const GreetingCard = (greeting) => {
const { message, name } = greeting;
return (
<div className="card">
<img src="https://placehold.co/600x400/EEE/31343C" alt={name} />
<h2>
{message} <span>{name}</span>!
</h2>
</div>
);
};
function App() {
const greetingsArray = [
{
name: "Nageshwar",
message: "Hi, how are you?",
},
{
name: "Prateek",
message: "Happy to meet you",
},
{
name: "Praveen",
message: "Good Morning",
},
{
name: "Pankaj",
message: "Good Evening",
},
{
name: "Vishal",
message: "Good Night",
},
{
name: "Shubham",
message: "Happy Birthday",
},
{
name: "Akash",
message: "Happy Anniversary",
},
{
name: "Vishal",
message: "Happy Birthday",
},
{
name: "Shubham",
message: "Happy Anniversary",
},
];
return (
<div id="container">
{greetingsArray.map((greeting, index) => (
<GreetingCard key={index} {...greeting} />
))}
</div>
);
}
ReactDOM.render(<App />, document.getElementById("root"));
</script>
</html>