import React from 'react' import styles from './index.module.less' import { Histogram } from '../../types/searchSelect' import { Tooltip } from 'antd' type ComponentProps = { histogram: Histogram onTempChange: (index: number) => any onChange: (index: number) => any onRecover: () => any } const RangeFilterHistogram: React.FC = ({ histogram, /** * @description 鼠标悬浮的时候 临时改变range值 */ onTempChange, /** * @description 鼠标点击的时候 改变range值 */ onChange, /** * @description 鼠标移走的时候 恢复临时改变的range值 */ onRecover, }) => { const { buckets = [] } = histogram if (!buckets.length) return null return (
{buckets.map(({ count, percentage }, i) => (
onTempChange(i)} onClick={() => onChange(i)} >
))}
) } export default RangeFilterHistogram