diff --git a/app/javascript/src/components/Button/Button.tsx b/app/javascript/src/components/Button/Button.tsx new file mode 100644 index 0000000..ffb7609 --- /dev/null +++ b/app/javascript/src/components/Button/Button.tsx @@ -0,0 +1,42 @@ +import type { MouseEvent } from "react"; +import React from "react"; +import cn from "classnames"; + +type Props = React.DetailedHTMLProps< + React.ButtonHTMLAttributes, + HTMLButtonElement +> & { + variant?: "primary" | "dangeour"; +}; + +const baseStyles = + "cursor-pointer py-2 px-4 disabled:opacity-50 disabled:cursor-default text-white w-full transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg"; + +const Component: React.ForwardRefRenderFunction = (props) => { + const { className = "", variant = "primary", onClick, ...rest } = props; + + const handleClick = ( + e: MouseEvent + ) => { + e.stopPropagation(); + + if (onClick) { + onClick(e); + } + }; + + const variantStyle = + variant === "primary" + ? "bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 focus:ring-offset-blue-200" + : "bg-red-600 hover:bg-red-700 focus:ring-red-500 focus:ring-offset-red-200"; + + return ( + + ); diff --git a/app/javascript/src/pages/Home/StakeOrderModal/StakeOrderModal.tsx b/app/javascript/src/pages/Home/StakeOrderModal/StakeOrderModal.tsx index 6ccd473..32b634d 100644 --- a/app/javascript/src/pages/Home/StakeOrderModal/StakeOrderModal.tsx +++ b/app/javascript/src/pages/Home/StakeOrderModal/StakeOrderModal.tsx @@ -1,20 +1,17 @@ import type { ChangeEvent, FC } from "react"; import React, { useState } from "react"; -import cx from "classnames"; import { BigNumber } from "bignumber.js"; import { useRelayEnvironment } from "react-relay"; -import { Modal } from "../../../components"; +import { Button, Modal } from "../../../components"; import { commitCreateStakeOrderMutation } from "./createStakeOrder"; +import { Input } from "../../../components/Input/Input"; type Props = { poolName: string; balance: string; }; -const inputBaseStyles = - "rounded-lg border-transparent flex-1 appearance-none border border-gray-300 w-full py-2 px-4 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent mb-3"; - export const StakeOrderModal: FC = ({ poolName, balance }) => { const environment = useRelayEnvironment(); const [isOpen, setIsOpen] = useState(false); @@ -72,8 +69,7 @@ export const StakeOrderModal: FC = ({ poolName, balance }) => { CAKE disponível: {balance}
- = ({ poolName, balance }) => { {avaliableCake.isEqualTo(0) && ( Você não possuí saldo. )} - +
diff --git a/app/javascript/src/pages/Orders/Exchange/ExchangePanel/ExchangePanel.tsx b/app/javascript/src/pages/Orders/Exchange/ExchangePanel/ExchangePanel.tsx index ce98d57..3bece62 100644 --- a/app/javascript/src/pages/Orders/Exchange/ExchangePanel/ExchangePanel.tsx +++ b/app/javascript/src/pages/Orders/Exchange/ExchangePanel/ExchangePanel.tsx @@ -11,6 +11,7 @@ import type { ExchangePanel_fiatBalances$key } from "./__generated__/ExchangePan import type { ExchangePanel_balances$key } from "./__generated__/ExchangePanel_balances.graphql"; import { commitCreateSellCryptoOrderMutation } from "./createSellCryptoOrder"; import { commitCreateBuyCryptoOrderMutation } from "./createBuyCryptoOrder"; +import { Input, Button } from "../../../../components"; const tabBaseStyles = "w-full text-base font-bold text-black px-4 py-2 focus:ring-blue-500"; @@ -18,9 +19,6 @@ const tabBaseStyles = const selectedTabStyles = "bg-blue-600 hover:bg-blue-700 rounded-l-frounded-full text-white"; -const inputBaseStyles = - "rounded-lg border-transparent flex-1 appearance-none border border-gray-300 w-full py-2 px-4 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent mb-3"; - type Props = { fiatBalancesRefs: ExchangePanel_fiatBalances$key; balancesRefs: ExchangePanel_balances$key; @@ -161,8 +159,7 @@ export const ExchangePanel: FC = ({
{exchangeOption === "BUY" ? ( <> - = ({ ) : ( <> - = ({ )}
- + );