From eb6c9a104eee8f4c39d7c9f785b8866c77a9c89f Mon Sep 17 00:00:00 2001 From: MH4GF Date: Sun, 22 Dec 2024 15:17:44 +0900 Subject: [PATCH] fix: add hovered underline option to UniversalLink component --- app/_features/viewTransition/UniversalLink.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/_features/viewTransition/UniversalLink.tsx b/app/_features/viewTransition/UniversalLink.tsx index 17732210..b3511101 100644 --- a/app/_features/viewTransition/UniversalLink.tsx +++ b/app/_features/viewTransition/UniversalLink.tsx @@ -8,14 +8,27 @@ import { isSameOrigin } from "./isSameOrigin"; const animatedUnderline = "no-underline transition-colors duration-300 border-b border-solid border-zinc-200 hover:border-zinc-500 dark:border-zinc-700 dark:hover:border-zinc-500"; +const hoveredUnderline = + "no-underline hover:border-b hover:border-solid hover:border-zinc-200 dark:hover:border-zinc-700"; + type Props = LinkProps & { isExternal?: boolean; isEnabledUnderline?: boolean; + isEnabledHoveredUnderline?: boolean; }; export const UniversalLink = forwardRef( - ({ isExternal, isEnabledUnderline = false, className: _className, ...props }: Props, ref) => { - const className = `${_className || ""} ${isEnabledUnderline ? animatedUnderline : ""}`; + ( + { + isExternal, + isEnabledUnderline = false, + isEnabledHoveredUnderline = false, + className: _className, + ...props + }: Props, + ref, + ) => { + const className = `${_className || ""} ${isEnabledUnderline ? animatedUnderline : isEnabledHoveredUnderline ? hoveredUnderline : ""}`; if (isExternal || !isSameOrigin(props.href)) { return (