-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from pierobassa/improve-profile-buy-ux
- Loading branch information
Showing
7 changed files
with
99 additions
and
179 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,83 @@ | ||
import { ethers } from "ethers"; | ||
import { useMemo } from "react"; | ||
import { FaEthereum, FaGem } from "react-icons/fa"; | ||
|
||
type Props = { | ||
buyPrice: ethers.BigNumber; | ||
sellPrice: ethers.BigNumber; | ||
onBuyClick?: () => void; | ||
onSellClick?: () => void; | ||
}; | ||
|
||
export const GemsPriceInfo: React.FC<Props> = ({ | ||
buyPrice, | ||
sellPrice, | ||
onBuyClick, | ||
onSellClick | ||
}) => { | ||
const buyPriceEther = useMemo(() => { | ||
return ethers.utils.formatEther(buyPrice); | ||
}, [buyPrice]); | ||
|
||
const sellPriceEther = useMemo(() => { | ||
return ethers.utils.formatEther(sellPrice); | ||
}, [sellPrice]); | ||
|
||
return ( | ||
<div className="bg-[#FF89A9] flex flex-col items-center rounded-md text-[#2b2b2b] py-1 px-2"> | ||
<div className="flex flex-row items-center gap-1 "> | ||
<div> | ||
<FaGem /> | ||
</div> | ||
<p className="font-medium text-lg">Buy/Sell gems</p> | ||
</div> | ||
<div className="flex flex-row items-center gap-0.5 "> | ||
{onBuyClick ? ( | ||
<button | ||
className="py-1 px-2 flex flex-row items-center bg-[#006400] hover:brightness-90 rounded-md " | ||
onClick={onBuyClick} | ||
> | ||
<div className="text-white"> | ||
<FaEthereum /> | ||
</div> | ||
<div className="pl-1 text-white font-medium"> | ||
{buyPriceEther} ETH | ||
</div> | ||
</button> | ||
) : ( | ||
<div className="py-1 px-2 flex flex-row items-center bg-[#006400] rounded-md "> | ||
<div className="text-white"> | ||
<FaEthereum /> | ||
</div> | ||
<div className="pl-1 text-white font-medium"> | ||
{buyPriceEther} ETH | ||
</div> | ||
</div> | ||
)} | ||
|
||
{onSellClick ? ( | ||
<button | ||
className="py-1 px-2 flex flex-row items-center bg-[#99324e] hover:brightness-90 rounded-md " | ||
onClick={onSellClick} | ||
> | ||
<div className="text-white"> | ||
<FaEthereum /> | ||
</div> | ||
<div className="pl-1 text-white font-medium"> | ||
{sellPriceEther} ETH | ||
</div> | ||
</button> | ||
) : ( | ||
<div className="py-1 px-2 flex flex-row items-center bg-[#99324e] rounded-md "> | ||
<div className="text-white"> | ||
<FaEthereum /> | ||
</div> | ||
<div className="pl-1 text-white font-medium"> | ||
{sellPriceEther} ETH | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
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 @@ | ||
export * from "./GemsPriceInfo"; |
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 @@ | ||
export * from "./GemsPriceInfo"; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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