Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adjust style and class name #140

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .release/.changeset/little-books-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Adjust style class name
3 changes: 3 additions & 0 deletions apps/canonical-bridge-ui/core/theme/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const dark = {
warning: '#FFEADB',
danger: '#F8545F',
route: { title: '#8C8F9B' },
network: {
title: '#8C8F9B',
},
on: {
color: {
primary: '#181A1E',
Expand Down
3 changes: 3 additions & 0 deletions apps/canonical-bridge-ui/core/theme/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const light = {
warning: '#BC4E00',
danger: '#EF2A37',
route: { title: '#5C5F6A' },
network: {
title: '#8C8F9B',
},
on: {
color: {
primary: '#FFFFFF',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function StateModal(props: StateModalProps) {
return (
<Modal isOpen={isOpen} onClose={onClose} isCentered {...restProps}>
<LightMode>
<ModalOverlay />
<ModalOverlay className={`${className}-overlay`} />

<ModalContent className={className} borderRadius={'20px'} maxW={'435px'}>
<ModalCloseButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export function ChooseTokenModal(props: ChooseTokenModalProps) {

return (
<ListItem
className={`bccb-widget-token-list-item` + (isDisabled ? '-disabled' : '')}
className={
`bccb-widget-token-list-item` +
(isActive ? '-active' : isDisabled ? '-disabled' : '')
}
key={item.address}
iconUrl={item.icon}
isActive={isActive}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function BaseModal(props: BaseModalProps) {
}}
/>
</Flex>
<Flex flexDir="column" p="20px 0px 16px" flex={1}>
<Flex className={`${className}-body`} flexDir="column" p="20px 0px 16px" flex={1}>
<Flex px={'20px'} mb={'20px'}>
<SearchInput
className={`${className}-search`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const ListItem = React.forwardRef((props: ListItemProps, ref: any) => {
return (
<Box className={`${className}-wrapper`} ref={ref} p="0 20px 4px">
<Flex
className={`${className}` + isDisabled ? '-disabled' : ''}
className={className}
borderRadius={'8px'}
px={'11px'}
py="7px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,27 @@ export function TransferButton({
signTransaction,
]);

const isDisabled =
isLoading ||
isGlobalFeeLoading ||
!sendValue ||
!Number(sendValue) ||
!transferActionInfo ||
!isTransferable ||
(isTronTransfer && (!isToAddressChecked || !toAccount?.address || !isTronAvailableToAccount)) ||
isTronContract === true ||
!!evmBytecode ||
(isSolanaTransfer &&
(!isToAddressChecked || !toAccount.address || !isSolanaAvailableToAccount));

return (
<Flex className="bccb-widget-transfer-button" flexDir="column" w={'100%'}>
<Flex
className={`bccb-widget-transfer-button` + `${isDisabled ? ' disabled' : ''}`}
flexDir="column"
w={'100%'}
>
<Button
className={isDisabled ? 'disabled' : ''}
bg={theme.colors[colorMode].button.brand.default}
size={'lg'}
fontWeight={500}
Expand All @@ -453,20 +471,7 @@ export function TransferButton({
_disabled: { bg: theme.colors[colorMode].button.disabled },
}}
onClick={sendTx}
isDisabled={
isLoading ||
isGlobalFeeLoading ||
!sendValue ||
!Number(sendValue) ||
!transferActionInfo ||
!isTransferable ||
(isTronTransfer &&
(!isToAddressChecked || !toAccount?.address || !isTronAvailableToAccount)) ||
isTronContract === true ||
!!evmBytecode ||
(isSolanaTransfer &&
(!isToAddressChecked || !toAccount.address || !isSolanaAvailableToAccount))
}
isDisabled={isDisabled}
>
{isApproveNeeded
? formatMessage({ id: 'transfer.button.approve' })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export const NetWorkSection = () => {
justifyContent={'space-between'}
flex={1}
>
<Typography variant="label" size={'md'} color={theme.colors[colorMode].text.placeholder}>
<Typography
variant="label"
size={'md'}
color={theme.colors[colorMode].text.network.title}
>
{formatMessage({ id: 'from.section.title' })}
</Typography>
</Flex>
Expand All @@ -30,7 +34,11 @@ export const NetWorkSection = () => {
ml="48px"
display={{ base: 'none', md: 'flex' }}
>
<Typography variant="label" size={'md'} color={theme.colors[colorMode].text.placeholder}>
<Typography
variant="label"
size={'md'}
color={theme.colors[colorMode].text.network.title}
>
{formatMessage({ id: 'to.section.title' })}
</Typography>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ export const ReceiveInfo = ({ onOpen }: ReceiveInfoProps) => {
<Box className="bccb-widget-received-info-container" mb={isHideSection ? '-24px' : 0}>
<Collapse in={!isHideSection} animateOpacity>
<Flex flexDir={'column'} gap={'8px'}>
<Flex flexDir={'row'} alignItems={'center'} justifyContent={'space-between'}>
<Flex
className="bccb-widget-received-info-title"
flexDir={'row'}
alignItems={'center'}
justifyContent={'space-between'}
>
<Typography
variant={'label'}
size={'md'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ export const SendInput: React.FC = () => {

return (
<Flex className="bccb-widget-transfer-input-container" flexDir={'column'} position={'relative'}>
<Flex flexDir={'row'} justifyContent={'space-between'}>
<Flex className="bccb-widget-input-title" flexDir={'row'} justifyContent={'space-between'}>
<Typography
className="input-header-label"
color={theme.colors[colorMode].text.placeholder}
color={theme.colors[colorMode].text.network.title}
variant={'label'}
size={'md'}
>
Expand All @@ -113,7 +113,9 @@ export const SendInput: React.FC = () => {
<MaxLink />
</Flex>
<Flex
className="bccb-widget-transfer-input-wrapper"
className={`bccb-widget-transfer-input-wrapper ${
!!error?.text ? 'input-error' : isFocused ? 'input-focused' : ''
}`}
flex={1}
mt={'8px'}
flexDir={'row'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function ToAccount(props: FlexProps) {
{formatMessage({ id: 'to.section.account.label' })}
</Box>
<InputGroup
className="bccb-widget-to-account-input"
className={`bccb-widget-to-account-input ${isInvalid ? 'input-error' : ''}`}
alignItems="center"
mt={'12px'}
_hover={{
Expand All @@ -130,6 +130,7 @@ export function ToAccount(props: FlexProps) {
}}
>
<Input
className={`${isInvalid ? 'input-error' : ''}`}
isInvalid={isInvalid}
background={theme.colors[colorMode].input.background}
borderColor={theme.colors[colorMode].input.border.default}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const RouteWrapper = ({

return (
<Flex
className="bccb-widget-route-wrapper"
className={`bccb-widget-route-wrapper${isSelected ? '-selected' : ''} ${
isError ? 'route-error' : ''
}`}
flex={1}
flexDir={'column'}
gap={'4px'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function TransferOverview({ routeContentBottom }: { routeContentBottom?:
>
{formatMessage({ id: 'route.title' })}
{!options.length || isGlobalFeeLoading ? (
<SkeletonCircle w={'32px'} h={'32px'} />
<SkeletonCircle className="skeleton" w={'32px'} h={'32px'} />
) : !isBase ? (
<RefreshingButton />
) : null}
Expand Down
Loading