Skip to content

Commit

Permalink
feat: history transaction icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodes05 committed Sep 9, 2023
1 parent fc29e27 commit 46adb60
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 0 deletions.
41 changes: 41 additions & 0 deletions libs/oeth/history/src/components/TransactionIcon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type { Meta, StoryObj } from '@storybook/react';
import { TransactionIcon } from './TransactionIcon';

const meta: Meta<typeof TransactionIcon> = {
component: TransactionIcon,
title: 'History/TransactionIcon',
args: {
type: 'yield',
},
};

export default meta;

export const Yield: StoryObj<typeof TransactionIcon> = {};

export const SmallScreen: StoryObj<typeof TransactionIcon> = {
parameters: {
viewport: {
defaultViewport: 'mobile1',
},
},
};

export const Sent: StoryObj<typeof TransactionIcon> = {
args: {
type: 'sent',
},
};

export const Received: StoryObj<typeof TransactionIcon> = {
args: {
type: 'received',
},
};

export const Swap: StoryObj<typeof TransactionIcon> = {
args: {
type: 'swap',
tokenIcon: 'https://app.oeth.com/images/currency/reth-icon-small.png',
},
};
68 changes: 68 additions & 0 deletions libs/oeth/history/src/components/TransactionIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Box } from '@mui/material';
import React from 'react';

type Props =
| {
type: 'sent' | 'received' | 'yield';
}
| { type: 'swap'; tokenIcon: string };

export function TransactionIcon(props: Props) {
return (
<Box
sx={{
position: 'relative',
width: { xs: '1.375rem', md: '2rem' },
height: { xs: '1.375rem', md: '2rem' },
}}
>
<Box
component="img"
src={props.type === 'yield' ? '/images/Yield.svg' : '/images/oeth.svg'}
sx={{
width: '100%',
height: '100%',
}}
></Box>
<Box
sx={{
width: { xs: '0.75rem', md: '1rem' },
height: { xs: '0.75rem', md: '1rem' },
position: 'absolute',
right: '-0.4rem',
bottom: 0,
zIndex: 1,
}}
component="img"
src={
props.type === 'sent'
? '/images/Send.svg'
: props.type === 'received' || props.type === 'yield'
? '/images/Received.svg'
: '/images/Swap.svg'
}
></Box>
{props.type === 'swap' && (
<Box
sx={{
position: 'absolute',
height: '100%',
width: '50%',
overflow: 'hidden',
top: 0,
left: 0,
}}
>
<Box
sx={{
width: { xs: '1.375rem', md: '2rem' },
height: { xs: '1.375rem', md: '2rem' },
}}
component="img"
src={props.tokenIcon}
></Box>
</Box>
)}
</Box>
);
}
14 changes: 14 additions & 0 deletions libs/shared/assets/files/Received.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions libs/shared/assets/files/Send.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions libs/shared/assets/files/Swap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions libs/shared/assets/files/Yield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 46adb60

Please sign in to comment.