mirror of
https://github.com/strapi/strapi.git
synced 2025-11-11 15:49:50 +00:00
feat(new notification): SA/add "target" prop to link {} (#9472)
* feat(NewNotification): Add "target" prop to link {}
Signed-off-by: ScottAgirs <scott@ijs.to>
* chore: Minor typo fix occured > occur(R)ed
Signed-off-by: ScottAgirs <scott@ijs.to>
* fix: Add missing target check
Signed-off-by: ScottAgirs <scott@ijs.to>
* chore: Remove external window arrow if !"_blank"
Signed-off-by: ScottAgirs <scott@ijs.to>
* chore: replace redundant fragment w Padded />
Signed-off-by: ScottAgirs <scott@ijs.to>
* fix: Indentation
Signed-off-by: ScottAgirs <scott@ijs.to>
This commit is contained in:
parent
de1575383c
commit
5311ca776e
@ -67,7 +67,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
const errorMessage = get(err, ['response', 'data', 'message'], 'An error occured');
|
||||
const errorMessage = get(err, ['response', 'data', 'message'], 'An error occurred');
|
||||
|
||||
strapi.notification.toggle({
|
||||
type: 'warning',
|
||||
|
||||
@ -88,7 +88,15 @@ const Notification = ({ notification }) => {
|
||||
<Text title={formattedMessage(message)}>{formattedMessage(message)}</Text>
|
||||
)}
|
||||
{link && (
|
||||
<a href={link.url} target="_blank" rel="noopener noreferrer">
|
||||
<a
|
||||
href={link.url}
|
||||
target={link.target || '_blank'}
|
||||
rel={
|
||||
!link.target || link.target === '_blank'
|
||||
? 'noopener noreferrer'
|
||||
: ''
|
||||
}
|
||||
>
|
||||
<Padded right left size="xs">
|
||||
<Flex alignItems="center">
|
||||
<Text
|
||||
@ -100,8 +108,11 @@ const Notification = ({ notification }) => {
|
||||
>
|
||||
{formattedMessage(link.label)}
|
||||
</Text>
|
||||
<Padded left size="xs" />
|
||||
{link.target === "_blank" && (
|
||||
<Padded left size="xs">
|
||||
<LinkArrow />
|
||||
</Padded>
|
||||
)}
|
||||
</Flex>
|
||||
</Padded>
|
||||
</a>
|
||||
@ -152,6 +163,7 @@ Notification.propTypes = {
|
||||
}),
|
||||
]),
|
||||
link: PropTypes.shape({
|
||||
target: PropTypes.string,
|
||||
url: PropTypes.string.isRequired,
|
||||
label: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user