Skip to content

Commit

Permalink
normalize discord invite links, remove noreferrer from discord invite…
Browse files Browse the repository at this point in the history
… links
  • Loading branch information
josefaidt committed Feb 6, 2025
1 parent dd83f6a commit 79a13ba
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 9 deletions.
9 changes: 7 additions & 2 deletions src/components/ExternalLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ type ExternalLinkProps = {
anchorTitle?: string;
icon?: boolean;
className?: string;
/**
* @default 'noopener noreferrer'
*/
rel?: string;
};

const ExternalLink: React.FC<ExternalLinkProps> = ({
children,
href,
className
className,
rel
}) => {
const [label, setLabel] = React.useState('');
const linkRef = useRef<HTMLAnchorElement>(null);
Expand All @@ -30,7 +35,7 @@ const ExternalLink: React.FC<ExternalLinkProps> = ({
href={href}
className={className}
aria-label={label + ' (opens in new tab)'}
rel="noopener noreferrer"
rel={rel || 'noopener noreferrer'}
target="_blank"
onClick={() => {
trackLink(href);
Expand Down
1 change: 1 addition & 0 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const Footer = ({ hasTOC = false }: FooterProps) => {
<ExternalLink
href={links.DISCORD}
className="footer-link footer-link--social"
rel={'noopener'}
>
<IconDiscord />
<VisuallyHidden>Discord</VisuallyHidden>
Expand Down
8 changes: 7 additions & 1 deletion src/components/LinkCard/LinkCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ interface LinkCardProps {
href?: string;
children: React.ReactNode;
icon: () => React.ReactNode;
/**
* @default "noopener noreferrer"
*/
rel?: string;
}

const LinkCard: React.FC<LinkCardProps> = ({
isExternal,
href,
children,
icon
icon,
rel
}) => {
return (
href && (
<Link
href={href}
isExternal={isExternal}
rel={rel || 'noopener noreferrer'}
className="link-card"
aria-label={children + ' (opens in new tab)'}
>
Expand Down
1 change: 1 addition & 0 deletions src/components/LinkCards/LinkCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const LinkCards: React.FC<LinkCardsProps> = ({ platform }) => {
<LinkCard
isExternal={true}
href={links.DISCORD}
rel={'noopener'}
icon={() => <IconDiscord fontSize="2rem" />}
>
Amplify Discord
Expand Down
2 changes: 1 addition & 1 deletion src/components/contribute/HowItWorks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function HowItWorks() {
<Text>
If this is your first approved pull request, the Amplify team
designates you as a Contributor in the{' '}
<ExternalLink href="https://discord.com/invite/amplify">
<ExternalLink href="https://discord.gg/amplify" rel="noopener">
Amplify Community Discord server <IconExternalLink />
</ExternalLink>
.
Expand Down
2 changes: 1 addition & 1 deletion src/fragments/lib-v1/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Amplify Flutter

Welcome to the Amplify Flutter documentation. To stay up to date with the latest changes and provide feedback, please take a look at our [Github repo](https://github.com/aws-amplify/amplify-flutter) or join us on [Discord](https://discord.gg/jWVbPfC).
Welcome to the Amplify Flutter documentation. To stay up to date with the latest changes and provide feedback, please take a look at our [Github repo](https://github.com/aws-amplify/amplify-flutter) or join us on [Discord](https://discord.gg/amplify).

Amplify Flutter v0 supports iOS/Android as target platforms.

Expand Down
2 changes: 1 addition & 1 deletion src/fragments/lib/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Amplify Flutter

Welcome to the Amplify Flutter documentation. To stay up to date with the latest changes and provide feedback, please take a look at our [GitHub repo](https://github.com/aws-amplify/amplify-flutter) or join us on [Discord](https://discord.gg/jWVbPfC).
Welcome to the Amplify Flutter documentation. To stay up to date with the latest changes and provide feedback, please take a look at our [GitHub repo](https://github.com/aws-amplify/amplify-flutter) or join us on [Discord](https://discord.gg/amplify).

The stable release of Amplify Flutter currently supports iOS, Android, Web, Windows, macOS, and Linux as target platforms. Currently Push Notifications and DataStore are supported for only iOS and Android.

Expand Down
4 changes: 2 additions & 2 deletions src/pages/contribute/getting-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default function GettingStarted() {
<Text>Learn more about the AWS Amplify JS library.</Text>

<Heading level={4}>
<ExternalLink href="https://discord.com/invite/amplify">
<ExternalLink href="https://discord.gg/amplify">
Amplify Community Discord server <IconExternalLink />
</ExternalLink>
</Heading>
Expand All @@ -270,7 +270,7 @@ export default function GettingStarted() {
Amplify JS.
</Text>
<Heading level={4}>
<ExternalLink href="https://discord.com/invite/amplify">
<ExternalLink href="https://discord.gg/amplify">
Amplify Discord Office Hours <IconExternalLink />
</ExternalLink>
</Heading>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,4 @@ Search for similar issues or open new issues on Github

Connect with [AWS Enterprise support](https://aws.amazon.com/premiumsupport/)

Join our [community Discord Channel](https://discord.com/invite/amplify)
Join our [community Discord Channel](https://discord.gg/amplify)

0 comments on commit 79a13ba

Please sign in to comment.