Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit a91fd6f

Browse files
committed
feat(hoveroverlay): export LinkComponent type
1 parent 038d307 commit a91fd6f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/HoverOverlay.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ import { HoveredToken } from './token_position'
1212
import { HoverMerged, LOADING } from './types'
1313
import { toPrettyBlobURL } from './url'
1414

15+
/** The component used to render a link */
16+
export type LinkComponent = React.ComponentType<{ to: string } & React.HTMLAttributes<HTMLElement>>
17+
1518
/**
1619
* Uses a placeholder `<button>` or a React Router `<Link>` depending on whether `to` is set.
1720
*/
1821
const ButtonOrLink: React.StatelessComponent<
19-
{ linkComponent: React.ComponentType<{ to: string }>; to?: string } & React.HTMLAttributes<HTMLElement>
22+
{ linkComponent: LinkComponent; to?: string } & React.HTMLAttributes<HTMLElement>
2023
> = ({ linkComponent, to, children, ...rest }) => {
2124
const Link = linkComponent
2225
return to ? (
@@ -56,7 +59,8 @@ export interface HoverOverlayProps {
5659
/** Whether to show the close button for the hover overlay */
5760
showCloseButton: boolean
5861

59-
linkComponent: React.ComponentType<{ to: string }>
62+
/** The component used to render links */
63+
linkComponent: LinkComponent
6064

6165
/** Called when the Go-to-definition button was clicked */
6266
onGoToDefinitionClick?: (event: MouseEvent) => void

0 commit comments

Comments
 (0)