-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathWelcome.jsx
More file actions
155 lines (141 loc) · 5.35 KB
/
Copy pathWelcome.jsx
File metadata and controls
155 lines (141 loc) · 5.35 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import React, { useContext } from "react";
import { AiFillPlayCircle } from "react-icons/ai";
import { SiEthereum } from "react-icons/si";
import { BsInfoCircle } from "react-icons/bs";
import { TransactionContext } from "../context/TransactionContext";
import { shortenAddress } from "../utils/shortenAddress";
import { Loader } from ".";
const companyCommonStyles =
"min-h-[70px] sm:px-0 px-2 sm:min-w-[120px] flex justify-center items-center border-[0.5px] border-gray-400 text-sm font-light text-white";
const Input = ({ placeholder, name, type, value, handleChange }) => (
<input
placeholder={placeholder}
type={type}
step="0.0001"
value={value}
onChange={(e) => handleChange(e, name)}
className="my-2 w-full rounded-sm p-2 outline-none bg-transparent text-white border-none text-sm white-glassmorphism"
/>
);
const Welcome = () => {
const {
currentAccount,
connectWallet,
handleChange,
sendTransaction,
formData,
isLoading,
} = useContext(TransactionContext);
const handleSubmit = (e) => {
const { addressTo, amount, keyword, message } = formData;
e.preventDefault();
if (!addressTo || !amount || !keyword || !message) return;
sendTransaction();
};
return (
<div className="flex w-full justify-center items-center">
<div className="flex mf:flex-row flex-col items-start justify-between md:p-20 py-12 px-4">
<div className="flex flex-1 justify-start items-start flex-col mf:mr-10">
<h1 className="text-3xl sm:text-5xl text-white text-gradient py-1">
Send Crypto <br /> across the world
</h1>
<p className="text-left mt-5 text-white font-light md:w-9/12 w-11/12 text-base">
Explore the crypto world. Buy and sell cryptocurrencies easily on
Krypto.
</p>
{!currentAccount && (
<button
type="button"
onClick={connectWallet}
className="flex flex-row justify-center items-center my-5 bg-[#2952e3] p-3 rounded-full cursor-pointer hover:bg-[#2546bd]"
>
<AiFillPlayCircle className="text-white mr-2" />
<p className="text-white text-base font-semibold">
Connect Wallet
</p>
</button>
)}
<div className="grid sm:grid-cols-3 grid-cols-2 w-full mt-10">
<div className={`rounded-tl-2xl ${companyCommonStyles}`}>
Reliability
</div>
<div className={companyCommonStyles}>Security</div>
<div className={`sm:rounded-tr-2xl ${companyCommonStyles}`}>
Ethereum
</div>
<div className={`sm:rounded-bl-2xl ${companyCommonStyles}`}>
Web 3.0
</div>
<div className={companyCommonStyles}>Low Fees</div>
<div className={`rounded-br-2xl ${companyCommonStyles}`}>
Blockchain
</div>
</div>
</div>
<div className="flex flex-col flex-1 items-center justify-start w-full mf:mt-0 mt-10">
<div className="p-3 flex justify-end items-start flex-col rounded-xl h-40 sm:w-72 w-full my-5 eth-card .white-glassmorphism ">
<div className="flex justify-between flex-col w-full h-full">
<div className="flex justify-between items-start">
<div className="w-10 h-10 rounded-full border-2 border-white flex justify-center items-center">
<SiEthereum fontSize={21} color="#fff" />
</div>
<BsInfoCircle fontSize={17} color="#fff" />
</div>
<div>
{currentAccount ? (
<p className="text-white font-light text-sm">
{shortenAddress(currentAccount)}
</p>
) : (
<p className="text-white font-light text-sm">Address</p>
)}
<p className="text-white font-semibold text-lg mt-1">
Ethereum
</p>
</div>
</div>
</div>
<div className="p-5 sm:w-96 w-full flex flex-col justify-start items-center blue-glassmorphism">
<Input
placeholder="Address To"
name="addressTo"
type="text"
handleChange={handleChange}
/>
<Input
placeholder="Amount (ETH)"
name="amount"
type="number"
handleChange={handleChange}
/>
<Input
placeholder="Keyword (Gif)"
name="keyword"
type="text"
handleChange={handleChange}
/>
<Input
placeholder="Enter Message"
name="message"
type="text"
handleChange={handleChange}
/>
<div className="h-[1px] w-full bg-gray-400 my-2" />
{isLoading ? (
<Loader />
) : (
<button
type="button"
onClick={handleSubmit}
className="text-white w-full mt-2 border-[1px] p-2 border-[#3d4f7c] hover:bg-[#3d4f7c] rounded-full cursor-pointer"
>
Send now
</button>
)}
</div>
</div>
</div>
</div>
);
};
export default Welcome;