Download wp-calypso/client/landing/subscriptions/components/link/link.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 587 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/landing/subscriptions/components/link/link.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/landing/subscriptions/components/link/link.tsx
-
curl -L -o link.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/landing/subscriptions/components/link/link.tsx
587 Bytes
| import { Link as RouterLink, LinkProps as RouterLinkProps } from 'react-router-dom'; | |
| import { useSubscriptionManagerContext } from '../subscription-manager-context'; | |
| type LinkProps = Omit< RouterLinkProps, 'to' > & | |
| Omit< React.HTMLProps< HTMLAnchorElement >, 'ref' > & { active?: boolean }; | |
| const Link = ( { active = false, ...props }: LinkProps ) => { | |
| const { isSubscriptionsPortal } = useSubscriptionManagerContext(); | |
| if ( active || isSubscriptionsPortal ) { | |
| return <RouterLink to={ props.href || '' } { ...props } />; | |
| } | |
| return <a { ...props }></a>; | |
| }; | |
| export default Link; | |