1 import type { CSSProperties, ReactNode } from 'react';
2 import { useRef } from 'react';
3 import { AutoSizer, List } from 'react-virtualized';
5 import { DENSITY } from '@proton/shared/lib/constants';
6 import type { UserSettings } from '@proton/shared/lib/interfaces/UserSettings';
7 import clsx from '@proton/utils/clsx';
11 userSettings: UserSettings;
12 contactRowHeightComfort?: number;
13 contactRowHeightCompact?: number;
14 rowRenderer: ({ index, style, key }: { index: number; style: CSSProperties; key: string }) => ReactNode;
18 const ContactSelectorList = ({
20 contactRowHeightComfort = 54,
21 contactRowHeightCompact = 46,
26 const listRef = useRef(null);
27 const containerRef = useRef(null);
28 const isCompactView = userSettings.Density === DENSITY.COMPACT;
31 <div ref={containerRef} className={clsx(['h-custom', className])} style={{ '--h-custom': `18.75rem` }}>
33 {({ height, width }) => (
35 className="contact-list outline-none"
37 rowRenderer={rowRenderer}
41 rowHeight={isCompactView ? contactRowHeightCompact : contactRowHeightComfort}
49 export default ContactSelectorList;