1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/multichain/activity-list-item/activity-list-item.stories.js
Binij Shrestha ceadfacb21
Fix/18884 migrate avatar network (#19079)
* Migrate AvatarNetwokr

fixing error

fix textAlign

added AvatarNetworkSize

NetworkProps extends BaseProps instead of Boxprops

omitted children from base, made name required

replace deprecated and fix lint

* update AvatarNetwork TS

* add AvatarNetworkSize test

* remove unused size import

* Update ui/components/component-library/avatar-network/avatar-network.types.ts

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* fix readme

* update to latest box component

---------

Co-authored-by: garrettbear <gwhisten@gmail.com>
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
2023-07-24 11:15:33 -07:00

103 lines
2.6 KiB
JavaScript

import React from 'react';
import TransactionStatusLabel from '../../app/transaction-status-label';
import TransactionIcon from '../../app/transaction-icon';
import CancelButton from '../../app/cancel-button';
import {
BackgroundColor,
Color,
Display,
FontWeight,
TextAlign,
TextVariant,
} from '../../../helpers/constants/design-system';
import {
AvatarNetwork,
AvatarNetworkSize,
BadgeWrapper,
BadgeWrapperAnchorElementShape,
Box,
Text,
} from '../../component-library';
import { ActivityListItem } from './activity-list-item';
export default {
title: 'Components/Multichain/ActivityListItem',
component: ActivityListItem,
};
const Template = (args) => <ActivityListItem {...args} />;
export const DefaultStory = Template.bind({});
DefaultStory.args = {
'data-testid': 'activity-list-item',
onClick: () => {
console.log('clicked list item');
},
className: 'custom-class',
title: 'Activity Title',
icon: (
<BadgeWrapper
anchorElementShape={BadgeWrapperAnchorElementShape.circular}
positionObj={{ top: -4, right: -4 }}
display={Display.Block}
badge={
<AvatarNetwork
className="activity-tx__network-badge"
data-testid="activity-tx-network-badge"
size={AvatarNetworkSize.Xs}
name="Network Name"
src="./images/eth_logo.png"
borderWidth={1}
borderColor={BackgroundColor.backgroundDefault}
/>
}
>
<TransactionIcon category="interaction" status="failed" />
</BadgeWrapper>
),
subtitle: (
<TransactionStatusLabel
statusOnly
isPending
isEarliestNonce
error={{}}
date={new Date().toDateString()}
status="pending"
/>
),
rightContent: (
<>
<Text
variant={TextVariant.bodyLgMedium}
fontWeight={FontWeight.Medium}
color={Color.textDefault}
title="Primary Currency"
textAlign={TextAlign.Right}
data-testid="transaction-list-item-primary-currency"
className="activity-list-item__primary-currency"
ellipsis
>
Primary Currency
</Text>
<Text
variant={TextVariant.bodyMd}
color={Color.textAlternative}
textAlign={TextAlign.Right}
data-testid="transaction-list-item-secondary-currency"
>
Secondary Currency
</Text>
</>
),
children: (
<Box paddingTop={4} className="transaction-list-item__pending-actions">
<CancelButton
transaction={{}}
cancelTransaction={() => {
console.log('canceled');
}}
/>
</Box>
),
};