Skip to content

Commit

Permalink
Rollback and use a specific link
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierfacq committed Sep 13, 2023
1 parent a531565 commit d37d4fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/components/LinkText/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import React from 'react';
type LinkTextProps = {
href: string;
children?: React.ReactNode;
target?: string,
rel?: string
};

const LinkText = ({ href, children, target, rel }: LinkTextProps) => {
const LinkText = ({ href, children }: LinkTextProps) => {
return (
href.startsWith('http') ? <a href={href} target={target ? target : '_blank'} rel={rel ? rel : 'noreferrer'}>{children}</a> : <Link to={href}>{children}</Link>
href.startsWith('http') ? <a href={href} target='_blank' rel='noreferrer'>{children}</a> : <Link to={href}>{children}</Link>
)
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/RandomContributor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useAdoptiumContributorsApi, useOnScreen } from '../../hooks';
import './RandomContributor.scss';
import AnimatedPlaceholder from '../AnimatedPlaceholder';
import { Trans } from 'gatsby-plugin-react-i18next';
import LinkText from '../LinkText'
import Link from '@mui/material/Link';

const RandomContributor = (): JSX.Element => {
const ref = useRef<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -32,9 +32,9 @@ const RandomContributor = (): JSX.Element => {
i18nKey="asciidoc.random.contributor.text"
defaults='Thank you <profileUri>{{login}}</profileUri> for making <commitsListUri>{{contributionsCount}} contributions</commitsListUri> to <repoUri>{{repo}}</repoUri>'
components={{
profileUri: <LinkText href={contributor.profileUri} target="_blank" rel="nofollow noopener noreferrer"/>,
commitsListUri: <LinkText href={contributor.commitsListUri} target="_blank" rel="nofollow noopener noreferrer"/>,
repoUri: <LinkText href={`https://github.com/adoptium/${contributor.repo}`} target="_blank" rel="nofollow noopener noreferrer"/>,
profileUri: <Link href={contributor.profileUri} target="_blank" rel="nofollow noopener noreferrer" />,
commitsListUri: <Link href={contributor.commitsListUri} target="_blank" rel="nofollow noopener noreferrer"/>,
repoUri: <Link href={`https://github.com/adoptium/${contributor.repo}`} target="_blank" rel="nofollow noopener noreferrer"/>,
}}
values={{
'login': contributor.login,
Expand Down

0 comments on commit d37d4fb

Please sign in to comment.