Skip to content

Commit

Permalink
nojira | @rebeccahongsf | fixup action-link className
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahongsf committed May 2, 2024
1 parent 83a8a12 commit ae54a3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/elements/action-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type Props = HtmlHTMLAttributes<HTMLAnchorElement> & {
href: string
};

const ActionLink = ({ children, ...props }: Props) => {
const ActionLink = ({ children, className, ...props }: Props) => {
return (
<Link {...props} className={twMerge("relative", props.className)}>
<Link {...props} className={twMerge("relative", className?.replace("link--action", ""))}>
{children}
<ArrowRightIcon width={20} className="ml-2 inline-block" />
</Link>
Expand Down
12 changes: 6 additions & 6 deletions src/components/elements/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Props = HtmlHTMLAttributes<HTMLAnchorElement | HTMLButtonElement> & LinkPro
href: string
}

const DrupalLink = ({href, className, children, ...props}: Props) => {
const DrupalLink = ({href, children, ...props}: Props) => {
// Make sure all links have a href.
href = href || "#"
const drupalBase: string = (process.env.NEXT_PUBLIC_DRUPAL_BASE_URL || "").replace(/\/$/, "");
Expand All @@ -21,20 +21,20 @@ const DrupalLink = ({href, className, children, ...props}: Props) => {
href = href.replace(drupalBase, "").replace("<front>", "/");
}

if (className?.includes("link--action")) {
if (props.className?.includes("link--action")) {
return (
<ActionLink href={href} {...props}>
{children}
</ActionLink>
)
}

if (className?.includes("button")) {
if (props.className?.includes("button")) {
return (
<Button
href={href}
big={className.includes("--big")}
secondary={className.includes("--secondary")}
big={props.className.includes("--big")}
secondary={props.className.includes("--secondary")}
{...props}
>
{children}
Expand All @@ -43,7 +43,7 @@ const DrupalLink = ({href, className, children, ...props}: Props) => {
}

return (
<Link href={href} className={className} {...props}>
<Link href={href} className={props.className} {...props}>
{children}
{href.startsWith("mailto") &&
<EnvelopeIcon width={20} className="ml-4 inline-block"/>
Expand Down

0 comments on commit ae54a3a

Please sign in to comment.