Skip to content

Commit

Permalink
Merge pull request #1282 from nsbno/fix-external-links-for-action-link
Browse files Browse the repository at this point in the history
use as="a" for external links in actionLink
  • Loading branch information
Cmoen11 authored Oct 1, 2024
2 parents 0eaa93d + 3f7c5d8 commit 01164f8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions apps/docs/app/routes/_index/ActionLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Link, useNavigate } from "@remix-run/react";
import { Link } from "@remix-run/react";
import {
ComponentsOutline30Icon,
GuidelinesOutline30Icon,
HomeOutline30Icon,
StarsOutline30Icon,
TokensOutline30Icon,
TrainOutline30Icon,
StarsOutline30Icon,
} from "@vygruppen/spor-icon-react";
import {
Box,
BoxProps,
PressableCard,
Container,
Flex,
Heading,
PressableCard,
SimpleGrid,
Text,
} from "@vygruppen/spor-react";
Expand Down Expand Up @@ -110,8 +110,14 @@ type ActionLinkCardProps = {
children: React.ReactNode;
};
function ActionLinkCard({ to, children }: ActionLinkCardProps) {
const linkProps = to.match(/^https?:\/\//)
? { href: to, target: "_blank", rel: "noopener noreferrer" }
const linkProps: {
href?: string;
target?: string;
rel?: string;
as?: React.ElementType;
to?: string;
} = to.match(/^https?:\/\//)
? { href: to, target: "_blank", rel: "noopener noreferrer", as: "a" }
: { as: Link, to };

return (
Expand Down

0 comments on commit 01164f8

Please sign in to comment.