Skip to content

Commit

Permalink
✨ Use internal to setup target in links (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
enZane authored Sep 10, 2024
1 parent f2a494d commit 7453f13
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
11 changes: 9 additions & 2 deletions starters/next/components/ui/CTA/CTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ export const CTA = ({
{actions && actions.length > 0 && (
<div className="flex flex-wrap justify-center gap-4">
{actions.slice(0, 2).map(
({ text, href, variant }, index) =>
({ text, href, variant, internal, ...actionProps }, index) =>
href && (
<Button
key={index}
variant={variant || index === 1 ? 'outline' : 'default'}
asChild
{...actionProps}
>
<a href={href}>{text}</a>
<a
target={internal ? '_self' : '_blank'}
rel="noopener noreferrer"
href={href}
>
{text}
</a>
</Button>
)
)}
Expand Down
11 changes: 9 additions & 2 deletions starters/next/components/ui/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,21 @@ export const Hero = ({
{actions && actions.length > 0 && (
<div className="flex flex-wrap justify-center gap-4 lg:justify-start">
{actions.slice(0, 2).map(
({ text, href, variant }, index) =>
({ text, href, variant, internal, ...actionProps }, index) =>
href && (
<Button
key={index}
variant={variant || index === 1 ? 'outline' : 'default'}
asChild
{...actionProps}
>
<a href={href}>{text}</a>
<a
target={internal ? '_self' : '_blank'}
rel="noopener noreferrer"
href={href}
>
{text}
</a>
</Button>
)
)}
Expand Down
11 changes: 9 additions & 2 deletions starters/remix/app/components/ui/CTA/CTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ export const CTA = ({
{actions && actions.length > 0 && (
<div className="flex flex-wrap justify-center gap-4">
{actions.slice(0, 2).map(
({ text, href, variant }, index) =>
({ text, href, variant, internal, ...actionProps }, index) =>
href && (
<Button
key={index}
variant={variant || index === 1 ? 'outline' : 'default'}
asChild
{...actionProps}
>
<a href={href}>{text}</a>
<a
target={internal ? '_self' : '_blank'}
rel="noopener noreferrer"
href={href}
>
{text}
</a>
</Button>
)
)}
Expand Down
11 changes: 9 additions & 2 deletions starters/remix/app/components/ui/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,21 @@ export const Hero = ({
{actions && actions.length > 0 && (
<div className="flex flex-wrap justify-center gap-4 lg:justify-start">
{actions.slice(0, 2).map(
({ text, href, variant }, index) =>
({ text, href, variant, internal, ...actionProps }, index) =>
href && (
<Button
key={index}
variant={variant || index === 1 ? 'outline' : 'default'}
asChild
{...actionProps}
>
<a href={href}>{text}</a>
<a
target={internal ? '_self' : '_blank'}
rel="noopener noreferrer"
href={href}
>
{text}
</a>
</Button>
)
)}
Expand Down

0 comments on commit 7453f13

Please sign in to comment.