-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #2174
- Loading branch information
Showing
8 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Box } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import * as metadataMock from 'mocks/metadata/address'; | ||
import { test, expect } from 'playwright/lib'; | ||
|
||
import AddressMetadataAlert from './AddressMetadataAlert'; | ||
|
||
test('base view', async({ render }) => { | ||
const component = await render(<Box mt={ 1 }><AddressMetadataAlert tags={ [ metadataMock.noteTag ] }/></Box>); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Alert } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import type { AddressMetadataTagFormatted } from 'types/client/addressMetadata'; | ||
|
||
interface Props { | ||
tags: Array<AddressMetadataTagFormatted> | undefined; | ||
} | ||
|
||
const AddressMetadataAlert = ({ tags }: Props) => { | ||
const noteTag = tags?.find(({ tagType }) => tagType === 'note'); | ||
if (!noteTag) { | ||
return null; | ||
} | ||
|
||
const content = noteTag.meta?.data; | ||
|
||
if (!content) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Alert | ||
mt="-4px" | ||
mb={ 6 } | ||
status="error" | ||
bgColor={ noteTag.meta?.alertBgColor } | ||
color={ noteTag.meta?.alertTextColor } | ||
whiteSpace="pre-wrap" | ||
sx={{ | ||
'& a': { | ||
color: 'link', | ||
_hover: { | ||
color: 'link_hovered', | ||
}, | ||
}, | ||
}} | ||
dangerouslySetInnerHTML={{ __html: content }} | ||
/> | ||
); | ||
}; | ||
|
||
export default React.memo(AddressMetadataAlert); |
Binary file added
BIN
+4.3 KB
...ess/details/__screenshots__/AddressMetadataAlert.pw.tsx_default_base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters