fix(link): fix missing ref on forward component

This commit is contained in:
unix
2020-04-03 14:40:53 +08:00
parent 41e05a16b5
commit e17c8dbd05

View File

@@ -24,14 +24,14 @@ const defaultProps = {
type NativeAttrs = Omit<React.AnchorHTMLAttributes<any>, keyof Props>
export type LinkProps = Props & typeof defaultProps & NativeAttrs
const Link: React.FC<React.PropsWithChildren<LinkProps>> = React.memo(React.forwardRef(({
const Link = React.memo(React.forwardRef<HTMLAnchorElement, React.PropsWithChildren<LinkProps>>(({
href, color, underline, pure, children, className, block, ...props
}, ref: React.Ref<HTMLAnchorElement>) => {
const theme = useTheme()
const linkColor = color || block ? theme.palette.success : 'inherit'
const padding = block ? theme.layout.gapQuarter : '0'
const decoration = underline ? 'underline' : 'none'
return (
<a className={`link ${className}`} href={href} {...props} ref={ref}>
{children}