Chore(Link): Remove code redundancies (#1111)

This commit is contained in:
camcam 2023-05-25 09:58:11 +07:00 committed by GitHub
parent 8b324d3943
commit 5b9d85e098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,9 +64,13 @@ export function useLink(originalProps: UseLinkProps) {
otherProps.target = otherProps.target ?? "_blank";
}
if (as !== "a") {
otherProps.role = "link";
}
/**
* if (as !== "a") {
* otherProps.role = "link";
* }
* This logic handled by @react-aria/link.
* See: https://github.com/adobe/react-spectrum/blob/5a3315f560071087cacf846bd2a86d8f47692446/packages/%40react-aria/link/src/useLink.ts#L55
*/
const classNames = useMemo(
() =>
@ -87,7 +91,7 @@ export function useLink(originalProps: UseLinkProps) {
};
};
return {Component, children, anchorIcon, linkProps, showAnchorIcon, getLinkProps};
return {Component, children, anchorIcon, showAnchorIcon, getLinkProps};
}
export type UseLinkReturn = ReturnType<typeof useLink>;