Allow line breaks for <a> tags

This commit is contained in:
Umihiko Iwasa
2024-07-07 11:29:07 +09:00
committed by GitHub
parent a2fde6dc7e
commit bbe62ea0b2

View File

@@ -8,14 +8,14 @@ const CustomLink = ({ href, ...rest }: LinkProps & AnchorHTMLAttributes<HTMLAnch
const isAnchorLink = href && href.startsWith('#') const isAnchorLink = href && href.startsWith('#')
if (isInternalLink) { if (isInternalLink) {
return <Link href={href} {...rest} /> return <Link className="break-words" href={href} {...rest} />
} }
if (isAnchorLink) { if (isAnchorLink) {
return <a href={href} {...rest} /> return <a className="break-words" href={href} {...rest} />
} }
return <a target="_blank" rel="noopener noreferrer" href={href} {...rest} /> return <a className="break-words" target="_blank" rel="noopener noreferrer" href={href} {...rest} />
} }
export default CustomLink export default CustomLink