Skip to content

Commit

Permalink
fix input back color, select border color, donate button type
Browse files Browse the repository at this point in the history
  • Loading branch information
RamRamez committed Sep 21, 2024
1 parent f1b63ed commit 606250d
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 42 deletions.
1 change: 1 addition & 0 deletions src/components/input/BaseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const BaseInput = memo(
BaseInput.displayName = 'BaseInput';

const Input = styled.input`
background-color: inherit;
border: 0;
flex: 1;
font-size: 18px;
Expand Down
101 changes: 60 additions & 41 deletions src/components/views/donate/OneTime/OneTimeDonationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
IconRefresh16,
IconWalletOutline24,
neutralColors,
OutlineButton,
semanticColors,
} from '@giveth/ui-design-system';
// @ts-ignore
Expand Down Expand Up @@ -439,6 +440,12 @@ const CryptoDonation: FC<{
isConnected && setShowSelectTokenModal(true)
}
disabled={!isConnected}
style={{
color:
selectedOneTimeToken || !isConnected
? 'inherit'
: brandColors.giv[500],
}}
>
{selectedOneTimeToken ? (
<Flex gap='8px' $alignItems='center'>
Expand Down Expand Up @@ -466,40 +473,46 @@ const CryptoDonation: FC<{
decimals={selectedOneTimeToken?.decimals}
/>
</InputWrapper>
<FlexStyled
gap='4px'
$alignItems='center'
disabled={!selectedOneTimeToken}
>
<GLinkStyled
size='Small'
onClick={() => setAmount(selectedTokenBalance - gasfee)}
{selectedOneTimeToken ? (
<FlexStyled
gap='4px'
$alignItems='center'
disabled={!selectedOneTimeToken}
>
{formatMessage({
id: 'label.available',
})}
:{' '}
{selectedOneTimeToken
? truncateToDecimalPlaces(
formatUnits(
selectedTokenBalance,
tokenDecimals,
),
tokenDecimals / 3,
)
: 0.0}
</GLinkStyled>
<IconWrapper onClick={() => !isRefetching && refetch()}>
{isRefetching ? (
<Spinner size={16} />
) : (
<IconRefresh16 />
<GLinkStyled
size='Small'
onClick={() =>
setAmount(selectedTokenBalance - gasfee)
}
>
{formatMessage({
id: 'label.available',
})}
:{' '}
{selectedOneTimeToken
? truncateToDecimalPlaces(
formatUnits(
selectedTokenBalance,
tokenDecimals,
),
tokenDecimals / 3,
)
: 0.0}
</GLinkStyled>
<IconWrapper onClick={() => !isRefetching && refetch()}>
{isRefetching ? (
<Spinner size={16} />
) : (
<IconRefresh16 />
)}
</IconWrapper>
{insufficientGasFee && (
<WarnError>{amountErrorText}</WarnError>
)}
</IconWrapper>
{insufficientGasFee && (
<WarnError>{amountErrorText}</WarnError>
)}
</FlexStyled>
</FlexStyled>
) : (
<div style={{ height: '21.5px' }} />
)}
</FlexStyled>
{hasActiveQFRound && !isOnQFEligibleNetworks && walletChainType && (
<DonateQFEligibleNetworks />
Expand Down Expand Up @@ -535,15 +548,21 @@ const CryptoDonation: FC<{
})}
/>
)}
{isConnected && (
<MainButton
id='Donate_Final'
label={formatMessage({ id: 'label.donate' })}
disabled={donationDisabled}
size='medium'
onClick={handleDonate}
/>
)}
{isConnected &&
(donationDisabled ? (
<OutlineButton
label={formatMessage({ id: 'label.donate' })}
disabled
size='medium'
/>
) : (
<MainButton
id='Donate_Final'
label={formatMessage({ id: 'label.donate' })}
size='medium'
onClick={handleDonate}
/>
))}
{!isConnected && (
<MainButton
label={formatMessage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,10 @@ export const InputWrapper = styled(Flex)`
align-items: center;
`;

export const Input = styled(AmountInput)`
export const Input = styled(AmountInput)<{ disabled?: boolean }>`
background-color: ${props =>
props.disabled ? neutralColors.gray[300] : 'white'};
opacity: ${props => (props.disabled ? 0.4 : 1)};
width: 100%;
border-left: 2px solid ${neutralColors.gray[300]};
#amount-input {
Expand Down

0 comments on commit 606250d

Please sign in to comment.