Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for external links in feature announcements #26491

Merged
merged 7 commits into from
Oct 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ export const NotificationDetailsFooter = ({
</>
)}
{footer.type === 'footer_feature_announcement' && (
<>
<Box
display={Display.Flex}
gap={4}
flexDirection={FlexDirection.Row}
width={BlockSize.Full}
>
<footer.ExternalLink notification={notification} />
<footer.ExtensionLink notification={notification} />
</>
</Box>
)}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ export const components: NotificationComponent<FeatureAnnouncementNotification>
href={`/${notification.data.extensionLink.extensionLinkRoute}`}
id={notification.id}
endIconName={false}
// Even if the link is not external, it will open in a new tab
// to avoid breaking the popup
isExternal={true}
/>
) : null,
ExternalLink: ({ notification }) =>
notification.data.externalLink ? (
<NotificationDetailButton
notification={notification}
variant={ButtonVariant.Secondary}
text={notification.data.externalLink.externalLinkText}
href={`${notification.data.externalLink.externalLinkUrl}`}
id={notification.id}
endIconName={false}
isExternal={true}
/>
) : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type FooterOnChainNotification<N = Notification> = {
type FooterFeatureAnnouncement<N = Notification> = {
type: 'footer_feature_announcement';
ExtensionLink: NotificationFC<N>;
ExternalLink: NotificationFC<N>;
};

/**
Expand Down
Loading