wallet-connect-web-examples/wallets/react-wallet-v2/src/components/PairingCard.tsx
Jonathan Conn a48d4b6aa9
feat: added selector tags for e2e testing (#240)
* feat: added selector tags for e2e testing

* Update wallets/react-wallet-v2/README.md

Co-authored-by: Ben Kremer <ben@walletconnect.com>

* Update wallets/react-wallet-v2/README.md

Co-authored-by: Ben Kremer <ben@walletconnect.com>

* Update wallets/react-wallet-v2/src/components/Navigation.tsx

Co-authored-by: Ben Kremer <ben@walletconnect.com>

---------

Co-authored-by: Ben Kremer <ben@walletconnect.com>
2023-07-13 23:10:06 -04:00

56 lines
1.4 KiB
TypeScript

import { truncate } from '@/utils/HelperUtil'
import { Avatar, Button, Card, Link, Text, Tooltip } from '@nextui-org/react'
import Image from 'next/image'
/**
* Types
*/
interface IProps {
logo?: string
name?: string
url?: string
topic?: string
onDelete: () => Promise<void>
}
/**
* Component
*/
export default function PairingCard({ logo, name, url, topic, onDelete }: IProps) {
return (
<Card
bordered
borderWeight="light"
css={{
position: 'relative',
marginBottom: '$6',
minHeight: '70px'
}}
>
<Card.Body
css={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
overflow: 'hidden'
}}
>
<Avatar src={logo} />
<div style={{ flex: 1 }}>
<Text h5 css={{ marginLeft: '$9' }}>
{name}
</Text>
<Link href={url} css={{ marginLeft: '$9' }}>
{truncate(url?.split('https://')[1] ?? 'Unknown', 23)}
</Link>
</div>
<Tooltip content="Delete" placement="left">
<Button size="sm" color="error" flat onClick={onDelete} css={{ minWidth: 'auto' }} data-testid={'pairing-delete-' + topic}>
<Image src={'/icons/delete-icon.svg'} width={15} height={15} alt="delete icon" />
</Button>
</Tooltip>
</Card.Body>
</Card>
)
}