mirror of
https://github.com/strapi/strapi.git
synced 2025-11-04 20:07:19 +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) {
|
} 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({
|
strapi.notification.toggle({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
|
|||||||
@ -88,7 +88,15 @@ const Notification = ({ notification }) => {
|
|||||||
<Text title={formattedMessage(message)}>{formattedMessage(message)}</Text>
|
<Text title={formattedMessage(message)}>{formattedMessage(message)}</Text>
|
||||||
)}
|
)}
|
||||||
{link && (
|
{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">
|
<Padded right left size="xs">
|
||||||
<Flex alignItems="center">
|
<Flex alignItems="center">
|
||||||
<Text
|
<Text
|
||||||
@ -100,8 +108,11 @@ const Notification = ({ notification }) => {
|
|||||||
>
|
>
|
||||||
{formattedMessage(link.label)}
|
{formattedMessage(link.label)}
|
||||||
</Text>
|
</Text>
|
||||||
<Padded left size="xs" />
|
{link.target === "_blank" && (
|
||||||
|
<Padded left size="xs">
|
||||||
<LinkArrow />
|
<LinkArrow />
|
||||||
|
</Padded>
|
||||||
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Padded>
|
</Padded>
|
||||||
</a>
|
</a>
|
||||||
@ -152,6 +163,7 @@ Notification.propTypes = {
|
|||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
link: PropTypes.shape({
|
link: PropTypes.shape({
|
||||||
|
target: PropTypes.string,
|
||||||
url: PropTypes.string.isRequired,
|
url: PropTypes.string.isRequired,
|
||||||
label: PropTypes.oneOfType([
|
label: PropTypes.oneOfType([
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user