mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
* first version of the pack * single entry point * add custom components to the package * move form components to toolkit * add more utils and hooks to the package * minor fixes * add CI workflow * update readme and package.json * fix ts * fix build of env-validator * fix docker build * fix icons size * test fixes * more test fixes
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { Flex, chakra } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import type { AddressMetadataTagFormatted } from 'types/client/addressMetadata';
|
|
|
|
import type { AlertProps } from 'toolkit/chakra/alert';
|
|
import { Alert } from 'toolkit/chakra/alert';
|
|
|
|
interface Props {
|
|
tags: Array<AddressMetadataTagFormatted> | undefined;
|
|
className?: string;
|
|
}
|
|
|
|
const AddressMetadataAlert = ({ tags, className }: Props) => {
|
|
const noteTags = tags?.filter(({ tagType }) => tagType === 'note').filter(({ meta }) => meta?.data);
|
|
|
|
if (!noteTags?.length) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Flex flexDir="column" gap={ 3 } className={ className }>
|
|
{ noteTags.map((noteTag) => (
|
|
<Alert
|
|
key={ noteTag.name }
|
|
status={ noteTag.meta?.alertStatus as AlertProps['status'] ?? 'error' }
|
|
bgColor={ noteTag.meta?.alertBgColor }
|
|
color={ noteTag.meta?.alertTextColor }
|
|
whiteSpace="pre-wrap"
|
|
display="inline-block"
|
|
css={{
|
|
'& a': {
|
|
color: 'link.primary',
|
|
_hover: {
|
|
color: 'link.primary.hover',
|
|
},
|
|
},
|
|
}}
|
|
>
|
|
<div dangerouslySetInnerHTML={{ __html: noteTag.meta?.data ?? '' }}/>
|
|
</Alert>
|
|
)) }
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default React.memo(chakra(AddressMetadataAlert));
|