chore(trading): use action icon buttons (#4550)

This commit is contained in:
m.ray 2023-08-16 17:38:19 +03:00 committed by GitHub
parent 809f149df9
commit e3ed71bec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -80,7 +80,7 @@ describe('OrderListTable', () => {
'-',
Schema.OrderTimeInForceCode[marketOrder.timeInForce],
getDateTimeFormat().format(new Date(marketOrder.createdAt)),
'Edit',
'',
];
expectedValues.forEach((expectedValue, i) =>
expect(cells[i]).toHaveTextContent(expectedValue)
@ -104,7 +104,7 @@ describe('OrderListTable', () => {
Schema.OrderTimeInForceCode[limitOrder.timeInForce]
}: ${getDateTimeFormat().format(new Date(limitOrder.expiresAt ?? ''))}`,
getDateTimeFormat().format(new Date(limitOrder.createdAt)),
'Edit',
'',
];
expectedValues.forEach((expectedValue, i) =>
expect(cells[i]).toHaveTextContent(expectedValue)

View File

@ -271,8 +271,8 @@ export const OrderListTable = memo<
{
colId: 'amend',
...COL_DEFS.actions,
minWidth: showAllActions ? 110 : COL_DEFS.actions.minWidth,
maxWidth: showAllActions ? 110 : COL_DEFS.actions.minWidth,
minWidth: showAllActions ? 90 : COL_DEFS.actions.minWidth,
maxWidth: showAllActions ? 90 : COL_DEFS.actions.minWidth,
cellRenderer: ({ data }: { data?: Order }) => {
if (!data) return null;
@ -285,14 +285,14 @@ export const OrderListTable = memo<
data-testid="edit"
onClick={() => onEdit(data)}
>
{t('Edit')}
<VegaIcon name={VegaIconNames.EDIT} size={16} />
</ButtonLink>
)}
<ButtonLink
data-testid="cancel"
onClick={() => onCancel(data)}
>
{t('Cancel')}
<VegaIcon name={VegaIconNames.CROSS} size={16} />
</ButtonLink>
</>
)}

View File

@ -211,7 +211,7 @@ describe('Positions', () => {
);
});
const cells = screen.getAllByRole('gridcell');
expect(cells[11].textContent).toEqual('Close');
expect(cells[11].textContent).toEqual('');
});
it('do not display close button if openVolume is zero', async () => {

View File

@ -23,6 +23,8 @@ import {
TooltipCellComponent,
ExternalLink,
Icon,
VegaIconNames,
VegaIcon,
} from '@vegaprotocol/ui-toolkit';
import {
volumePrefix,
@ -391,7 +393,7 @@ export const PositionsTable = ({
data-testid="close-position"
onClick={() => data && onClose(data)}
>
{t('Close')}
<VegaIcon name={VegaIconNames.CROSS} size={16} />
</ButtonLink>
) : null}
{data?.assetId && (