Skip to content

Commit

Permalink
fix github link, support disabling tooltips' clickToPin
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Dec 27, 2021
1 parent 706acd1 commit f017b36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/github-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const GithubImg = styled.img`

export function GithubIssuesLink({ Tooltip, }: { Tooltip: FC<Props> }) {
return (
<Tooltip id={"github-header"} css={center} arrow placement="bottom" title="See this project's open issues on GitHub">
<Tooltip id={"github-header"} css={center} clickToPin={false} arrow placement="bottom" title="See this project's open issues on GitHub">
<GithubLink href={issuesUrl}>
<GithubImg src={`data:image/png;base64,${githubLogo}`}/>
</GithubLink>
Expand Down
6 changes: 3 additions & 3 deletions src/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type LiftedState = {
setClicked: Setter<boolean>
}
export type CSS = { [k: string]: { [k: string]: string | number | undefined } }
export type Props = mui.TooltipProps & { id: string, css?: CSS }
export type Props = mui.TooltipProps & { id: string, css?: CSS, clickToPin?: boolean }
export type OuterProps = Props & MakeTooltipProps
export type InnerProps = OuterProps & LiftedState

Expand All @@ -34,7 +34,7 @@ export const OuterTooltip = (props: OuterProps) => {
export const InnerTooltip = mui.styled(
({
className, arrow, children, title,
id, openTooltipId, handleOpen, handleClose,
id, clickToPin, openTooltipId, handleOpen, handleClose,
clicked, setClicked,
...props
}: InnerProps) => {
Expand Down Expand Up @@ -66,6 +66,7 @@ export const InnerTooltip = mui.styled(
}
}
const handleTooltipClick = (e: any) => {
if (clickToPin === false) return // default to true
e.stopPropagation()
e.preventDefault()
// console.log("Tooltip: body click:", id)
Expand All @@ -88,7 +89,6 @@ export const InnerTooltip = mui.styled(
<mui.Tooltip
key={"mui.Tooltip"}
onClick={handleTooltipClick}
onMouseOver={handleTooltipOpen}
onOpen={handleTooltipOpen}
onClose={handleTooltipClose}
open={open || clicked}
Expand Down

0 comments on commit f017b36

Please sign in to comment.