import React, { useMemo } from 'react' import { Listbox } from '@headlessui/react' import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/solid' import { isEqual } from '../utils' const GroupSize = ({ tickSize, value, onChange, className = '' }) => { const sizes = useMemo( () => [ tickSize, tickSize * 5, tickSize * 10, tickSize * 50, tickSize * 100, ], [tickSize] ) return (
{({ open }) => ( <>
{value} {open ? ( ) : ( )}
{open ? ( {sizes.map((size) => ( {({ selected }) => (
{size}
)}
))}
) : null} )}
) } export default React.memo(GroupSize, (prevProps, nextProps) => isEqual(prevProps, nextProps, ['tickSize', 'value']) )