Skip to content

Commit

Permalink
feat: format stx properly, closes #342
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Nov 25, 2020
1 parent 64397e3 commit ee2729c
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions app/components/home/stacking-promo-card.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
import React, { FC } from 'react';
import { Box, Flex, Text, Button } from '@blockstack/ui';
import BigNumber from 'bignumber.js';

import btcPodium from '../../assets/images/btc-podium.svg';
import { openExternalLink } from '@utils/external-links';
import { BUY_STX_URL } from '@constants/index';
import btcPodium from '../../assets/images/btc-podium.svg';

interface StackingPromoCardProps {
minRequiredStx: number;
}

export const StackingPromoCard: FC<StackingPromoCardProps> = ({ minRequiredStx }) => (
<Box
mt="extra-loose"
borderRadius="8px"
boxShadow="0px 1px 2px rgba(0, 0, 0, 0.04);"
border="1px solid #F0F0F5"
>
<Flex flexDirection="column" mt="40px" mb="extra-loose">
<img src={btcPodium} />
<Text display="block" textAlign="center" textStyle="display.small" mt="loose">
Earn Bitcoin rewards with Stacking
</Text>
<Text display="block" mt="tight" textAlign="center" maxWidth="320px" mx="auto">
You can earn Bitcoin by temporarily locking {Math.ceil(minRequiredStx)} STX or more
</Text>
<Button
size="md"
mt="base"
mx="auto"
width="272px"
onClick={() => openExternalLink(BUY_STX_URL)}
>
Buy STX
</Button>
</Flex>
</Box>
);
export const StackingPromoCard: FC<StackingPromoCardProps> = ({ minRequiredStx }) => {
const amount = new BigNumber(Math.ceil(minRequiredStx)).toFormat();
return (
<Box
mt="extra-loose"
borderRadius="8px"
boxShadow="0px 1px 2px rgba(0, 0, 0, 0.04);"
border="1px solid #F0F0F5"
>
<Flex flexDirection="column" mt="40px" mb="extra-loose">
<img src={btcPodium} />
<Text display="block" textAlign="center" textStyle="display.small" mt="loose">
Earn Bitcoin rewards
</Text>
<Text display="block" mt="tight" textAlign="center" maxWidth="320px" mx="auto">
You’ll earn Bitcoin when you temporarily lock {amount} STX or more
</Text>
<Button
size="md"
mt="base"
mx="auto"
width="272px"
onClick={() => openExternalLink(BUY_STX_URL)}
>
Buy STX
</Button>
</Flex>
</Box>
);
};

0 comments on commit ee2729c

Please sign in to comment.