Skip to content

Commit

Permalink
More responsiveness and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Jul 25, 2024
1 parent 08f7483 commit 43b670a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
12 changes: 10 additions & 2 deletions src/components/Chain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ export const Chain = ({
}: ChainData) => {
const { isConnected, handleConnect, handleAddChain } =
useContext(Web3Context);
const handleAddChainClick = () => {

const handleConnectClick = (event: React.MouseEvent) => {
event.preventDefault();
handleConnect();
};

const handleAddChainClick = (event: React.MouseEvent) => {
event.preventDefault();
handleAddChain({ name, chainId, nativeCurrency, ...rest });
};

return (
<Link to={`/chain/${chainId}`}>
<Flex
Expand Down Expand Up @@ -68,7 +76,7 @@ export const Chain = ({
</Flex>
<Center mt="auto">
{!isConnected ? (
<Button onClick={handleConnect}>Connect Wallet</Button>
<Button onClick={handleConnectClick}>Connect</Button>
) : (
<Button onClick={handleAddChainClick}>Add Chain</Button>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Header = ({ showSearch = true, showFilters = true }) => {
size="lg"
onClick={handleConnect}
>
Connect Wallet
Connect
</Button>
) : (
<Button size="lg" w={{ base: "100%", md: "auto" }}>
Expand Down
9 changes: 8 additions & 1 deletion src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import { Header } from "./Header";
export const Layout = ({ children, headerProps = {} }) => (
<Flex flexDirection="column" py="4" px="8" height="100vh" position="relative">
<Header {...headerProps} />
<Flex as="main" flexDirection="column" mt={{ base: "164px", md: "16" }}>
<Flex
as="main"
flexDirection="column"
mt={{
base: headerProps.showSearch !== false ? "164px" : "116px",
md: "16",
}}
>
{children}
</Flex>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/components/RpcTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const RpcTable = ({ rpcs, handleRpcClick }) => {
<Td pl="0">{rpcUrl}</Td>
<Td pr="0" textAlign="end">
{!isConnected ? (
<Button onClick={handleConnect}>Connect Wallet</Button>
<Button onClick={handleConnect}>Connect</Button>
) : (
<Button onClick={() => handleRpcClick(rpcUrl)}>
Add Chain
Expand Down
19 changes: 14 additions & 5 deletions src/pages/chain/{Chain.chainId}.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,27 @@ const ChainPage = ({ data }: { data: { chain: ChainData } }) => {
<>
<Seo />
<Layout headerProps={{ showSearch: false, showFilters: false }}>
<Flex flexDirection="column" mt="8">
<Flex justifyContent="space-between" alignItems="center">
<Flex alignItems="center">
<Flex flexDirection="column" mt={["0", null, "8"]}>
<Flex
flexDirection={["column", null, "row"]}
justifyContent="space-between"
alignItems="center"
gap="6"
>
<Flex
flexDirection={["column", null, "row"]}
alignItems="center"
gap="6"
>
{icon && (
<Flex mr="6">
<Flex>
<ChainIcon name={name} icon={icon} width="60px" />
</Flex>
)}
<Heading size="2xl">{name}</Heading>
</Flex>
{!isConnected ? (
<Button onClick={handleConnect}>Connect Wallet</Button>
<Button onClick={handleConnect}>Connect</Button>
) : (
<Button onClick={handleAddChainClick}>Add Chain</Button>
)}
Expand Down

0 comments on commit 43b670a

Please sign in to comment.