mirror of
https://github.com/zhigang1992/react.git
synced 2026-02-02 09:08:52 +08:00
* feat(scaleable): add scaleable props to each component * chore(scaleable): update the exported type * feat: apply scaleable to components chore: remove with-default test: improve testcase for scaleable chore: resolve test warning ci: upgrade nodejs to latest lts docs: fix type error in document site * docs: update documents to be compatible with scaleable chore: fix build errors * chore: remove all size-related attributes docs: improve guide document * docs: add scaleable documentation test: update snapshots chore: remove unused * feat: add scaleable to grid components * docs: improve docs * test: update snapshots * fix(grid): fix basic component props
47 lines
969 B
TypeScript
47 lines
969 B
TypeScript
import React from 'react'
|
|
import Link from '../link'
|
|
|
|
interface Props {
|
|
href?: string
|
|
className?: string
|
|
}
|
|
|
|
const defaultProps = {
|
|
className: '',
|
|
}
|
|
|
|
type NativeAttrs = Omit<React.AnchorHTMLAttributes<any>, keyof Props>
|
|
export type UserLinkProps = Props & NativeAttrs
|
|
|
|
const UserLink = React.forwardRef<
|
|
HTMLAnchorElement,
|
|
React.PropsWithChildren<UserLinkProps>
|
|
>(
|
|
(
|
|
{
|
|
href,
|
|
className,
|
|
children,
|
|
...props
|
|
}: React.PropsWithChildren<UserLinkProps> & typeof defaultProps,
|
|
ref: React.Ref<HTMLAnchorElement>,
|
|
) => {
|
|
return (
|
|
<div className={className} {...props}>
|
|
<Link ref={ref} href={href} color target="_blank" rel="noopener">
|
|
{children}
|
|
</Link>
|
|
<style jsx>{`
|
|
div :global(a:hover) {
|
|
opacity: 0.7;
|
|
}
|
|
`}</style>
|
|
</div>
|
|
)
|
|
},
|
|
)
|
|
|
|
UserLink.defaultProps = defaultProps
|
|
UserLink.displayName = 'GeistUserLink'
|
|
export default UserLink
|