manifold/web/components/usa-map/usa-state.tsx
mantikoros 80d4bffc95
US Elections map (#943)
* usa map

* state election map

* senate midterms

* iframe

* fix

* /midterms

* listen for updates
2022-09-27 17:50:43 -05:00

35 lines
661 B
TypeScript

import clsx from 'clsx'
import { ClickHandler } from './usa-map'
type USAStateProps = {
state: string
dimensions: string
fill: string
onClickState?: ClickHandler
stateName: string
hideStateTitle?: boolean
}
export const USAState = ({
state,
dimensions,
fill,
onClickState,
stateName,
hideStateTitle,
}: USAStateProps) => {
return (
<path
d={dimensions}
fill={fill}
data-name={state}
className={clsx(
!!onClickState && 'hover:cursor-pointer hover:contrast-125'
)}
onClick={onClickState}
id={state}
>
{hideStateTitle ? null : <title>{stateName}</title>}
</path>
)
}