bridge_ui: Show swap arrow on hover
This commit is contained in:
parent
48fa0b783e
commit
43d858772a
|
@ -0,0 +1,28 @@
|
||||||
|
import { IconButton } from "@material-ui/core";
|
||||||
|
import { ArrowForward, SwapHoriz } from "@material-ui/icons";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function ChainSelectArrow({
|
||||||
|
onClick,
|
||||||
|
disabled,
|
||||||
|
}: {
|
||||||
|
onClick: () => void;
|
||||||
|
disabled: boolean;
|
||||||
|
}) {
|
||||||
|
const [showSwap, setShowSwap] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IconButton
|
||||||
|
onClick={onClick}
|
||||||
|
onMouseEnter={() => {
|
||||||
|
setShowSwap(true);
|
||||||
|
}}
|
||||||
|
onMouseLeave={() => {
|
||||||
|
setShowSwap(false);
|
||||||
|
}}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
{showSwap ? <SwapHoriz /> : <ArrowForward />}
|
||||||
|
</IconButton>
|
||||||
|
);
|
||||||
|
}
|
|
@ -4,8 +4,8 @@ import {
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { getAddress } from "@ethersproject/address";
|
import { getAddress } from "@ethersproject/address";
|
||||||
import { Button, IconButton, makeStyles, Typography } from "@material-ui/core";
|
import { Button, makeStyles, Typography } from "@material-ui/core";
|
||||||
import { ArrowForward, VerifiedUser } from "@material-ui/icons";
|
import { VerifiedUser } from "@material-ui/icons";
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useHistory } from "react-router";
|
import { useHistory } from "react-router";
|
||||||
|
@ -35,6 +35,7 @@ import {
|
||||||
} from "../../utils/consts";
|
} from "../../utils/consts";
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import ChainSelect from "../ChainSelect";
|
import ChainSelect from "../ChainSelect";
|
||||||
|
import ChainSelectArrow from "../ChainSelectArrow";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
import LowBalanceWarning from "../LowBalanceWarning";
|
import LowBalanceWarning from "../LowBalanceWarning";
|
||||||
import NumberTextField from "../NumberTextField";
|
import NumberTextField from "../NumberTextField";
|
||||||
|
@ -170,14 +171,12 @@ function Source() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.chainSelectArrow}>
|
<div className={classes.chainSelectArrow}>
|
||||||
<IconButton
|
<ChainSelectArrow
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
dispatch(setSourceChain(targetChain));
|
dispatch(setSourceChain(targetChain));
|
||||||
}}
|
}}
|
||||||
disabled={shouldLockFields}
|
disabled={shouldLockFields}
|
||||||
>
|
/>
|
||||||
<ArrowForward />
|
|
||||||
</IconButton>
|
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.chainSelectContainer}>
|
<div className={classes.chainSelectContainer}>
|
||||||
<Typography variant="caption">Target</Typography>
|
<Typography variant="caption">Target</Typography>
|
||||||
|
|
Loading…
Reference in New Issue