Fix/268 Overflow error text (#299)

* add break word for transaction dialog error state, add stories for transaction-dialog

* update story text to be more explanatory
This commit is contained in:
Matthew Russell 2022-04-26 18:48:29 -07:00 committed by GitHub
parent d0ec016adc
commit 5134df02b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,62 @@
import type { ComponentStory, ComponentMeta } from '@storybook/react';
import { TransactionDialog } from './transaction-dialog';
import { TxState } from '@vegaprotocol/react-helpers';
export default {
component: TransactionDialog,
title: 'TransactionDialog',
parameters: {
themes: false,
},
} as ComponentMeta<typeof TransactionDialog>;
const Template: ComponentStory<typeof TransactionDialog> = (args) => (
<TransactionDialog {...args} />
);
export const Requested = Template.bind({});
Requested.args = {
name: 'Some tx',
status: TxState.Requested,
error: null,
confirmations: 0,
txHash: null,
requiredConfirmations: 1,
confirmed: false,
};
export const Pending = Template.bind({});
Pending.args = {
name: 'Some tx',
status: TxState.Pending,
error: null,
confirmations: 1,
txHash: '0x123123',
requiredConfirmations: 3,
confirmed: false,
};
export const Error = Template.bind({});
Error.args = {
name: 'Some tx',
status: TxState.Error,
error: {
name: 'Error',
message:
'Some very long error message with text that should wrap, here is some error data: {"chain":3,"data":"0x08c379000000000000000000000000000000000000000000000000000000000"}',
},
confirmations: 0,
txHash: null,
requiredConfirmations: 1,
confirmed: false,
};
export const Complete = Template.bind({});
Complete.args = {
name: 'Some tx',
status: TxState.Complete,
error: null,
confirmations: 3,
txHash: '0x123123',
requiredConfirmations: 3,
confirmed: true,
};

View File

@ -38,7 +38,9 @@ export const TransactionDialog = ({
const renderContent = () => {
if (status === TxState.Error) {
return (
<p className="text-black dark:text-white">{error && error.message}</p>
<p className="break-all text-black dark:text-white">
{error && error.message}
</p>
);
}