1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

refactor: components struture

This commit is contained in:
2024-07-31 11:41:39 +02:00
parent ceeeb2f9c5
commit b5c50728de
72 changed files with 122 additions and 114 deletions

View File

@ -0,0 +1,35 @@
import { classNames } from "@repo/config-tailwind/classNames"
import { Link as NextLink } from "@repo/i18n/navigation"
import { FiExternalLink } from "react-icons/fi"
export interface LinkProps extends React.ComponentProps<typeof NextLink> {
isExternal?: boolean
}
/**
* Link is an actionable text component with connection to another web pages.
* @param props
* @returns
*/
export const Link: React.FC<LinkProps> = (props) => {
const { className, children, target, isExternal = true, ...rest } = props
return (
<NextLink
className={classNames(
"text-primary dark:text-primary-dark inline-flex items-center gap-1 font-semibold hover:underline focus:rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
className,
)}
target={target}
{...rest}
>
{children}
{target === "_blank" && isExternal ? (
<FiExternalLink size={16} strokeWidth={2.5} />
) : (
<></>
)}
</NextLink>
)
}