Commit a5534803 authored by Jack Short's avatar Jack Short Committed by GitHub

chore: migrating bag footer to styled components (#5791)

parent a06f8857
import { style } from '@vanilla-extract/css'
import { body } from 'nft/css/common.css'
import { sprinkles } from 'nft/css/sprinkles.css'
export const footer = style([
sprinkles({
background: 'backgroundModule',
color: 'textPrimary',
paddingX: '16',
paddingY: '12',
borderBottomLeftRadius: '12',
borderBottomRightRadius: '12',
}),
])
export const payButton = style([
body,
sprinkles({
background: 'accentAction',
border: 'none',
borderRadius: '12',
paddingY: '12',
fontWeight: 'semibold',
cursor: 'pointer',
justifyContent: 'center',
gap: '16',
}),
{
':disabled': {
opacity: '0.6',
cursor: 'auto',
},
},
])
...@@ -4,11 +4,10 @@ import { Trans } from '@lingui/macro' ...@@ -4,11 +4,10 @@ import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics' import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events' import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import Column from 'components/Column'
import Loader from 'components/Loader' import Loader from 'components/Loader'
import Row from 'components/Row'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import { Box } from 'nft/components/Box'
import { Column, Row } from 'nft/components/Flex'
import { bodySmall } from 'nft/css/common.css'
import { useBag } from 'nft/hooks/useBag' import { useBag } from 'nft/hooks/useBag'
import { useWalletBalance } from 'nft/hooks/useWalletBalance' import { useWalletBalance } from 'nft/hooks/useWalletBalance'
import { BagStatus } from 'nft/types' import { BagStatus } from 'nft/types'
...@@ -20,8 +19,6 @@ import styled from 'styled-components/macro' ...@@ -20,8 +19,6 @@ import styled from 'styled-components/macro'
import { ThemedText } from 'theme' import { ThemedText } from 'theme'
import { switchChain } from 'utils/switchChain' import { switchChain } from 'utils/switchChain'
import * as styles from './BagFooter.css'
const FooterContainer = styled.div` const FooterContainer = styled.div`
padding: 0px 12px; padding: 0px 12px;
` `
...@@ -37,6 +34,11 @@ const Footer = styled.div` ...@@ -37,6 +34,11 @@ const Footer = styled.div`
border-bottom-right-radius: 12px; border-bottom-right-radius: 12px;
` `
const FooterHeader = styled(Column)<{ warningText?: boolean }>`
padding-top: 8px;
padding-bottom: ${({ warningText }) => (warningText ? '8px' : '20px')};
`
const WarningIcon = styled(AlertTriangle)` const WarningIcon = styled(AlertTriangle)`
width: 14px; width: 14px;
margin-right: 4px; margin-right: 4px;
...@@ -51,6 +53,21 @@ const WarningText = styled(ThemedText.BodyPrimary)` ...@@ -51,6 +53,21 @@ const WarningText = styled(ThemedText.BodyPrimary)`
text-align: center; text-align: center;
` `
const PayButton = styled(Row)<{ disabled?: boolean }>`
background: ${({ theme }) => theme.accentAction};
color: ${({ theme }) => theme.accentTextLightPrimary};
font-weight: 600;
line-height: 24px;
font-size: 16px;
gap: 16px;
justify-content: center;
border: none;
border-radius: 12px;
padding: 12px 0px;
opacity: ${({ disabled }) => (disabled ? 0.6 : 1)};
cursor: ${({ disabled }) => (disabled ? 'auto' : 'pointer')};
`
interface ActionButtonProps { interface ActionButtonProps {
disabled?: boolean disabled?: boolean
onClick: () => void onClick: () => void
...@@ -58,9 +75,9 @@ interface ActionButtonProps { ...@@ -58,9 +75,9 @@ interface ActionButtonProps {
const ActionButton = ({ disabled, children, onClick }: PropsWithChildren<ActionButtonProps>) => { const ActionButton = ({ disabled, children, onClick }: PropsWithChildren<ActionButtonProps>) => {
return ( return (
<Row as="button" color="explicitWhite" className={styles.payButton} disabled={disabled} onClick={onClick}> <PayButton disabled={disabled} onClick={onClick}>
{children} {children}
</Row> </PayButton>
) )
} }
...@@ -155,21 +172,24 @@ export const BagFooter = ({ ...@@ -155,21 +172,24 @@ export const BagFooter = ({
return ( return (
<FooterContainer> <FooterContainer>
<Footer> <Footer>
<Column gap="4" paddingTop="8" paddingBottom={warningText ? '8' : '20'}> <FooterHeader gap="xs" warningText={!!warningText}>
<Row justifyContent="space-between"> <Row justify="space-between">
<Box> <div>
<ThemedText.HeadlineSmall>Total</ThemedText.HeadlineSmall> <ThemedText.HeadlineSmall>Total</ThemedText.HeadlineSmall>
</Box> </div>
<Box> <div>
<ThemedText.HeadlineSmall> <ThemedText.HeadlineSmall>
{formatWeiToDecimal(totalEthPrice.toString())}&nbsp;ETH {formatWeiToDecimal(totalEthPrice.toString())}&nbsp;ETH
</ThemedText.HeadlineSmall> </ThemedText.HeadlineSmall>
</Box> </div>
</Row> </Row>
<Row justifyContent="flex-end" color="textSecondary" className={bodySmall}> <Row justify="flex-end">
{`${ethNumberStandardFormatter(totalUsdPrice, true)}`} <ThemedText.BodySmall color="textSecondary" lineHeight="20px">{`${ethNumberStandardFormatter(
totalUsdPrice,
true
)}`}</ThemedText.BodySmall>
</Row> </Row>
</Column> </FooterHeader>
<TraceEvent <TraceEvent
events={[BrowserEvent.onClick]} events={[BrowserEvent.onClick]}
name={NFTEventName.NFT_BUY_BAG_PAY} name={NFTEventName.NFT_BUY_BAG_PAY}
......
...@@ -67,6 +67,7 @@ const fonts = { ...@@ -67,6 +67,7 @@ const fonts = {
function getSettings(darkMode: boolean) { function getSettings(darkMode: boolean) {
return { return {
grids: { grids: {
xs: '4px',
sm: '8px', sm: '8px',
md: '12px', md: '12px',
lg: '24px', lg: '24px',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment