chore: tidy up notification usage

This commit is contained in:
Matthew Russell
2023-02-22 14:18:07 -08:00
parent dbd49a6463
commit 92fa19d9e2
4 changed files with 49 additions and 42 deletions
@@ -318,33 +318,37 @@ const SummaryMessage = memo(
}
if (!pubKey) {
return (
<Notification
testId={'deal-ticket-connect-wallet'}
intent={Intent.Warning}
message={
<p className="text-sm pb-2">
You need a{' '}
<ExternalLink href="https://vega.xyz/wallet">
Vega wallet
</ExternalLink>{' '}
with {assetSymbol} to start trading in this market.
</p>
}
buttonProps={{
text: t('Connect wallet'),
action: openVegaWalletDialog,
dataTestId: 'order-connect-wallet',
size: 'md',
}}
/>
<div className="mb-4">
<Notification
testId={'deal-ticket-connect-wallet'}
intent={Intent.Warning}
message={
<p className="text-sm pb-2">
You need a{' '}
<ExternalLink href="https://vega.xyz/wallet">
Vega wallet
</ExternalLink>{' '}
with {assetSymbol} to start trading in this market.
</p>
}
buttonProps={{
text: t('Connect wallet'),
action: openVegaWalletDialog,
dataTestId: 'order-connect-wallet',
size: 'md',
}}
/>
</div>
);
}
if (errorMessage === SummaryValidationType.NoCollateral) {
return (
<ZeroBalanceError
asset={market.tradableInstrument.instrument.product.settlementAsset}
onClickCollateral={onClickCollateral}
/>
<div className="mb-4">
<ZeroBalanceError
asset={market.tradableInstrument.instrument.product.settlementAsset}
onClickCollateral={onClickCollateral}
/>
</div>
);
}
@@ -363,7 +367,11 @@ const SummaryMessage = memo(
// If there is no blocking error but user doesn't have enough
// balance render the margin warning, but still allow submission
if (balanceError) {
return <MarginWarning balance={balance} margin={margin} asset={asset} />;
return (
<div className="mb-4">
<MarginWarning balance={balance} margin={margin} asset={asset} />;
</div>
);
}
// Show auction mode warning
@@ -375,13 +383,15 @@ const SummaryMessage = memo(
].includes(marketData.marketTradingMode)
) {
return (
<Notification
intent={Intent.Warning}
testId={'dealticket-warning-auction'}
message={t(
'Any orders placed now will not trade until the auction ends'
)}
/>
<div className="mb-4">
<Notification
intent={Intent.Warning}
testId={'dealticket-warning-auction'}
message={t(
'Any orders placed now will not trade until the auction ends'
)}
/>
</div>
);
}
@@ -27,12 +27,13 @@ export const AssetProposalNotification = ({
</>
);
return (
<Notification
intent={Intent.Warning}
message={message}
testId="asset-proposal-notification"
className="mb-2"
/>
<div className="mb-2">
<Notification
intent={Intent.Warning}
message={message}
testId="asset-proposal-notification"
/>
</div>
);
}
@@ -34,7 +34,6 @@ export const MarketProposalNotification = ({
intent={Intent.Warning}
message={message}
testId="market-proposal-notification"
className="px-2 py-1"
/>
</div>
);
@@ -19,7 +19,6 @@ type NotificationProps = {
size?: ButtonSize;
};
testId?: string;
className?: string;
};
const getIcon = (intent: Intent): IconName => {
@@ -39,7 +38,6 @@ export const Notification = ({
title,
testId,
buttonProps,
className,
}: NotificationProps) => {
return (
<div
@@ -61,8 +59,7 @@ export const Notification = ({
intent === Intent.Warning,
'bg-vega-pink-300 dark:bg-vega-pink-650': intent === Intent.Danger,
},
'border rounded p-2 flex items-start gap-2.5 my-4',
className
'border rounded p-2 flex items-start gap-2.5'
)}
>
<div