Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update in ethereum card display #97

Open
wants to merge 1 commit 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
75 changes: 54 additions & 21 deletions client/src/components/Welcome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ 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 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
Expand All @@ -21,7 +22,14 @@ const Input = ({ placeholder, name, type, value, handleChange }) => (
);

const Welcome = () => {
const { currentAccount, connectWallet, handleChange, sendTransaction, formData, isLoading } = useContext(TransactionContext);
const {
currentAccount,
connectWallet,
handleChange,
sendTransaction,
formData,
isLoading,
} = useContext(TransactionContext);

const handleSubmit = (e) => {
const { addressTo, amount, keyword, message } = formData;
Expand All @@ -41,7 +49,8 @@ const Welcome = () => {
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.
Explore the crypto world. Buy and sell cryptocurrencies easily on
Krypto.
</p>
{!currentAccount && (
<button
Expand Down Expand Up @@ -84,34 +93,58 @@ const Welcome = () => {
<BsInfoCircle fontSize={17} color="#fff" />
</div>
<div>
<p className="text-white font-light text-sm">
{shortenAddress(currentAccount)}
</p>
{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} />
<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>
)}
{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>
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

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