-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
3,378 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
"use client"; | ||
|
||
import React, { FunctionComponent } from "react"; | ||
import { ConnectButton } from "@rainbow-me/rainbowkit"; | ||
import styles from "../styles/components/ethereumConnect.module.css"; | ||
import Button from "./button"; | ||
|
||
type EthereumConnectProps = { | ||
title: string; | ||
onClick?: () => void; | ||
updateEthStatus: (_: string) => void; | ||
}; | ||
|
||
const EthereumConnect: FunctionComponent<EthereumConnectProps> = ({ | ||
title, | ||
updateEthStatus, | ||
}) => { | ||
return ( | ||
<ConnectButton.Custom> | ||
{({ | ||
account, | ||
chain, | ||
openAccountModal, | ||
openChainModal, | ||
openConnectModal, | ||
authenticationStatus, | ||
mounted, | ||
}) => { | ||
// Note: If your app doesn't use authentication, you | ||
// can remove all 'authenticationStatus' checks | ||
const ready = mounted && authenticationStatus !== "loading"; | ||
const connected = | ||
ready && | ||
account && | ||
chain && | ||
(!authenticationStatus || authenticationStatus === "authenticated"); | ||
|
||
return ( | ||
<div | ||
className={styles.connectButton} | ||
{...(!ready && { | ||
"aria-hidden": true, | ||
style: { | ||
opacity: 0, | ||
pointerEvents: "none", | ||
userSelect: "none", | ||
}, | ||
})} | ||
> | ||
{(() => { | ||
if (!connected) { | ||
return ( | ||
<Button onClick={openConnectModal}> | ||
{title ? title : "Connect Wallet"} | ||
</Button> | ||
); | ||
} else if (connected) { | ||
updateEthStatus(account.address); | ||
} | ||
|
||
if (chain.unsupported) { | ||
return ( | ||
<button onClick={openChainModal} type="button"> | ||
Wrong network | ||
</button> | ||
); | ||
} | ||
|
||
return ( | ||
<div style={{ display: "flex", gap: 12 }}> | ||
<button | ||
onClick={openChainModal} | ||
style={{ display: "flex", alignItems: "center" }} | ||
type="button" | ||
> | ||
{chain.hasIcon && ( | ||
<div | ||
style={{ | ||
background: chain.iconBackground, | ||
width: 12, | ||
height: 12, | ||
borderRadius: 999, | ||
overflow: "hidden", | ||
marginRight: 4, | ||
}} | ||
> | ||
{chain.iconUrl && ( | ||
<img | ||
alt={chain.name ?? "Chain icon"} | ||
src={chain.iconUrl} | ||
style={{ width: 12, height: 12 }} | ||
/> | ||
)} | ||
</div> | ||
)} | ||
{chain.name} | ||
</button> | ||
|
||
<button onClick={openAccountModal} type="button"> | ||
{account.displayName} | ||
{account.displayBalance | ||
? ` (${account.displayBalance})` | ||
: ""} | ||
</button> | ||
</div> | ||
); | ||
})()} | ||
</div> | ||
); | ||
}} | ||
</ConnectButton.Custom> | ||
); | ||
}; | ||
|
||
export default EthereumConnect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
.screen { | ||
height: 88vh; | ||
position: relative; | ||
margin-top: 12vh; | ||
} | ||
|
||
.wrapperScreen { | ||
display: inline-flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
height: calc(100% - 12vh); | ||
padding: 0rem 0rem 2rem; | ||
} | ||
|
||
.container { | ||
height: 100%; | ||
display: flex; | ||
width: 100%; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
text-align: center; | ||
} | ||
|
||
.button_text { | ||
display: flex; | ||
gap: 1rem; | ||
} | ||
|
||
.chain_container { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 1rem; | ||
width: 100%; | ||
border-radius: 20px; | ||
} | ||
|
||
.domain_list { | ||
display: grid; | ||
grid-template-columns: repeat(4, minmax(0, 1fr)); | ||
gap: 2rem; | ||
width: 100%; | ||
overflow-y: auto; | ||
height: 100%; | ||
padding: 2rem 1rem 3rem; | ||
} | ||
|
||
.domain_box { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 1rem; | ||
min-height: 120px; | ||
padding: 1rem; | ||
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.06); | ||
border-radius: 12px; | ||
} | ||
|
||
.each_chain_container { | ||
display: flex; | ||
gap: 1rem; | ||
width: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
.each_chain_content { | ||
padding: 2rem; | ||
width: 100%; | ||
} | ||
|
||
.banner { | ||
display: flex; | ||
width: 80%; | ||
gap: 3rem; | ||
border-radius: 20px; | ||
background-color: #fffcf8; | ||
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.06); | ||
max-height: 430px; | ||
} | ||
|
||
.image { | ||
border-radius: 20px; | ||
width: 50%; | ||
aspect-ratio: 1; | ||
} | ||
|
||
.button_container { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
} | ||
|
||
.progress_bar_container { | ||
width: 70%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin-top: 2rem; | ||
} | ||
|
||
.connectButton { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
gap: 1rem; | ||
} | ||
|
||
.connectEthLayout { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
justify-content: center; | ||
} | ||
|
||
.banner_content { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: flex-start; | ||
gap: 1rem; | ||
padding: 3rem; | ||
} | ||
|
||
@media (min-width: 768px) and (max-width: 1024px) { | ||
.title { | ||
font-size: 2rem; | ||
} | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.title { | ||
font-size: 2rem; | ||
} | ||
|
||
.banner { | ||
flex-direction: column; | ||
height: auto; | ||
gap: 1rem; | ||
max-height: none; | ||
} | ||
|
||
.image { | ||
width: 100%; | ||
height: auto; | ||
aspect-ratio: 1; | ||
} | ||
|
||
.wrapperScreen { | ||
height: auto; | ||
} | ||
|
||
.domain_list { | ||
grid-template-columns: repeat(1, minmax(0, 1fr)); | ||
} | ||
} |
Oops, something went wrong.