Skip to content

Commit 3c3e8fc

Browse files
committedAug 14, 2021
feat(bar): remove bar item focus handler event as it's not used
1 parent 75481c6 commit 3c3e8fc

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed
 

‎packages/bar/src/Bar.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { Axes, Grid } from '@nivo/axes'
22
import { BarAnnotations } from './BarAnnotations'
3-
import {
4-
BarDatum,
5-
BarLayer,
6-
BarLayerId,
7-
BarSvgProps,
8-
ComputedBarDatumWithValue,
9-
} from './types'
3+
import { BarDatum, BarLayer, BarLayerId, BarSvgProps, ComputedBarDatumWithValue } from './types'
104
import { BarLegends } from './BarLegends'
115
import {
126
// @ts-ignore

‎packages/bar/src/BarItem.tsx

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BarDatum, BarItemProps } from './types'
22
import { animated, to } from '@react-spring/web'
3-
import { createElement, FocusEvent, MouseEvent, useCallback, useMemo } from 'react'
3+
import { createElement, MouseEvent, useCallback, useMemo } from 'react'
44
import { useTheme } from '@nivo/core'
55
import { useTooltip } from '@nivo/tooltip'
66

@@ -72,13 +72,10 @@ export const BarItem = <RawDatum extends BarDatum>({
7272
)
7373

7474
// extra handlers to allow keyboard navigation
75-
const handleFocus = useCallback(
76-
(event: FocusEvent<SVGRectElement>) => {
77-
console.log(bar)
78-
showTooltipAt(renderTooltip(), [bar.x, bar.y])
79-
},
80-
[showTooltipAt, renderTooltip, bar]
81-
)
75+
const handleFocus = useCallback(() => {
76+
console.log(bar)
77+
showTooltipAt(renderTooltip(), [bar.x, bar.y])
78+
}, [showTooltipAt, renderTooltip, bar])
8279
const handleBlur = useCallback(() => {
8380
hideTooltip()
8481
}, [hideTooltip])

‎packages/bar/src/BarLegends.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ interface BarLegendsProps {
88
toggleSerie: (id: string | number) => void
99
}
1010

11-
export const BarLegends = ({
12-
width,
13-
height,
14-
legends,
15-
toggleSerie,
16-
}: BarLegendsProps) => (
11+
export const BarLegends = ({ width, height, legends, toggleSerie }: BarLegendsProps) => (
1712
<>
1813
{legends.map(([legend, data], i) => (
1914
<BoxLegendSvg

0 commit comments

Comments
 (0)
Please sign in to comment.