-
Matiss Janis Aboltins authored
Part 4 of the migration. Final moves. Previous PR: https://github.com/actualbudget/actual/pull/1420
Matiss Janis Aboltins authoredPart 4 of the migration. Final moves. Previous PR: https://github.com/actualbudget/actual/pull/1420
ExternalLink.tsx 762 B
import React, { type ReactNode, forwardRef } from 'react';
import { colors } from '../../style';
let externalLinkColors = {
purple: colors.p4,
blue: colors.b4,
muted: 'inherit',
};
type ExternalLinkProps = {
children?: ReactNode;
to: string;
linkColor?: keyof typeof externalLinkColors;
};
const ExternalLink = forwardRef<HTMLAnchorElement, ExternalLinkProps>(
({ children, to, linkColor = 'blue' }, ref) => (
// we can’t use <ExternalLink /> here for obvious reasons
// eslint-disable-next-line no-restricted-syntax
<a
ref={ref}
href={to}
target="_blank"
rel="noopener noreferrer"
style={{ color: externalLinkColors[linkColor] }}
>
{children}
</a>
),
);
export default ExternalLink;