Skip to content

Commit

Permalink
feat(pie): fix typings for arc mouse handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Dec 18, 2020
1 parent b14ffcd commit 4d3d303
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions packages/arcs/src/useArcGenerator.ts
Expand Up @@ -5,11 +5,11 @@ import { ArcGenerator, Arc } from './types'
/**
* Memoize a d3 arc generator.
*
* Please note that both inner/outer radius should come
* aren't static and should come from the arc itself,
* while it requires more props on the arcs, it provides
* more flexibility because it's not limited to pie then
* but can also works with charts such as sunbursts.
* Please note that both inner/outer radius aren't static
* and should come from the arc itself, while it requires
* more props on the arcs, it provides more flexibility
* because it's not limited to pie then but can also works
* with charts such as sunbursts.
*/
export const useArcGenerator = ({
cornerRadius = 0,
Expand Down
8 changes: 4 additions & 4 deletions packages/pie/src/Slices.tsx
Expand Up @@ -39,15 +39,15 @@ export const Slices = <RawDatum,>({
const handleClick = useMemo(() => {
if (!isInteractive) return undefined

return (datum: ComputedDatum<RawDatum>, event: any) => {
return (datum: ComputedDatum<RawDatum>, event: React.MouseEvent<SVGPathElement>) => {
onClick?.(datum, event)
}
}, [isInteractive, onClick])

const handleMouseEnter = useMemo(() => {
if (!isInteractive) return undefined

return (datum: ComputedDatum<RawDatum>, event: any) => {
return (datum: ComputedDatum<RawDatum>, event: React.MouseEvent<SVGPathElement>) => {
showTooltipFromEvent(createElement(tooltip, { datum }), event)
setActiveId(datum.id)
onMouseEnter?.(datum, event)
Expand All @@ -57,7 +57,7 @@ export const Slices = <RawDatum,>({
const handleMouseMove = useMemo(() => {
if (!isInteractive) return undefined

return (datum: ComputedDatum<RawDatum>, event: any) => {
return (datum: ComputedDatum<RawDatum>, event: React.MouseEvent<SVGPathElement>) => {
showTooltipFromEvent(createElement(tooltip, { datum }), event)
onMouseMove?.(datum, event)
}
Expand All @@ -66,7 +66,7 @@ export const Slices = <RawDatum,>({
const handleMouseLeave = useMemo(() => {
if (!isInteractive) return undefined

return (datum: ComputedDatum<RawDatum>, event: any) => {
return (datum: ComputedDatum<RawDatum>, event: React.MouseEvent<SVGPathElement>) => {
hideTooltip()
setActiveId(null)
onMouseLeave?.(datum, event)
Expand Down

0 comments on commit 4d3d303

Please sign in to comment.