-
Notifications
You must be signed in to change notification settings - Fork 70
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
21 changed files
with
282 additions
and
161 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
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
44 changes: 17 additions & 27 deletions
44
apps/marginfi-v2-ui/src/components/AssetsList/AssetRow/AssetRowAction.tsx
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 |
---|---|---|
@@ -1,37 +1,27 @@ | ||
import { Button, ButtonProps } from "@mui/material"; | ||
import { useWallet } from "@solana/wallet-adapter-react"; | ||
import { FC, ReactNode } from "react"; | ||
import dynamic from "next/dynamic"; | ||
|
||
const WalletMultiButtonDynamic = dynamic( | ||
async () => (await import("@solana/wallet-adapter-react-ui")).WalletMultiButton, | ||
{ ssr: false } | ||
); | ||
|
||
interface AssetRowActionProps extends ButtonProps { | ||
children?: ReactNode; | ||
bgColor?: string; | ||
} | ||
|
||
const AssetRowAction: FC<AssetRowActionProps> = ({ children, disabled, bgColor, ...otherProps }) => { | ||
const wallet = useWallet(); | ||
|
||
return <Button | ||
className="normal-case text-[10px] sm:text-sm mx-2 sm:mx-0 w-14 sm:w-32 h-11 max-w-1 rounded-md" | ||
style={{ | ||
backgroundColor: disabled || !wallet.connected ? "gray" : bgColor ? bgColor : "rgb(227, 227, 227)", | ||
border: bgColor ? "solid 1px rgb(227, 227, 227)" : "none", | ||
color: bgColor === "rgba(0,0,0,0)" ? "rgb(227, 227, 227)" : "black", | ||
fontWeight: 400, | ||
fontFamily: "Aeonik Pro", | ||
zIndex: 10, | ||
}} | ||
{...otherProps} | ||
disabled={disabled || !wallet.connected} | ||
onClick={wallet.connected ? otherProps.onClick : () => wallet.connect()} | ||
> | ||
{children} | ||
</Button>; | ||
}; | ||
const AssetRowAction: FC<AssetRowActionProps> = ({ children, disabled, bgColor, ...otherProps }) => ( | ||
<Button | ||
className="normal-case text-[10px] sm:text-sm mx-2 sm:mx-0 w-14 sm:w-32 h-11 max-w-1 rounded-md" | ||
style={{ | ||
backgroundColor: disabled ? "gray" : bgColor ? bgColor : "rgb(227, 227, 227)", | ||
border: disabled ? "gray" : bgColor ? "solid 1px rgb(227, 227, 227)" : "solid 1px transparent", | ||
color: bgColor === "rgba(0,0,0,0)" ? "rgb(227, 227, 227)" : "black", | ||
fontWeight: 400, | ||
fontFamily: "Aeonik Pro", | ||
zIndex: 10, | ||
}} | ||
{...otherProps} | ||
disabled={disabled} | ||
> | ||
{children} | ||
</Button> | ||
); | ||
|
||
export { AssetRowAction }; |
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
Oops, something went wrong.