This commit is contained in:
mantikoros 2022-09-27 18:19:41 -04:00
parent 6eb27d12c3
commit 121680cbaa

View File

@ -7,7 +7,7 @@ import { USAState } from './usa-state'
export type ClickHandler<E = SVGPathElement | SVGCircleElement, R = any> = ( export type ClickHandler<E = SVGPathElement | SVGCircleElement, R = any> = (
e: React.MouseEvent<E, MouseEvent> e: React.MouseEvent<E, MouseEvent>
) => R ) => R
export type GetClickHandler = (stateKey: string) => ClickHandler export type GetClickHandler = (stateKey: string) => ClickHandler | undefined
export type CustomizeObj = { export type CustomizeObj = {
fill?: string fill?: string
clickHandler?: ClickHandler clickHandler?: ClickHandler
@ -62,9 +62,7 @@ export const USAMap = ({
const fillStateColor = (state: string) => const fillStateColor = (state: string) =>
customize?.[state]?.fill ? (customize[state].fill as string) : defaultFill customize?.[state]?.fill ? (customize[state].fill as string) : defaultFill
const stateClickHandler = (state: string) => const stateClickHandler = (state: string) => customize?.[state]?.clickHandler
customize?.[state]?.clickHandler
return ( return (
<svg <svg