import NextLink , { LinkProps } from 'next/link' ; import { FunctionComponent , PropsWithChildren } from 'react' ; type WorkLinkSource = 'works_search_result' | 'images_search_result' | 'item_auth_modal_back_to_work_link' | 'archive_tree' | 'viewer_back_link' | 'viewer_credit' ; type Props = { id : string ; source : WorkLinkSource ; resultPosition ? : number ; } & Omit < LinkProps , 'as' | 'href' > ; const WorkLink = ( { id , source , resultPosition , children , ... linkProps } ) => { return ( < NextLink href = { { pathname : `/work` , query : { id , source , resultPosition , } , } } as = { { pathname : `/works/${ id }` , } } { ... linkProps } > { children } < /NextLink>); } ; export default WorkLink ;