1 import { type FC, useRef } from 'react';
3 import { c } from 'ttag';
9 CollapsibleHeaderIconButton,
11 } from '@proton/components';
13 type Props = { info: { label: string; values: string[] }[] };
15 export const MoreInfoDropdown: FC<Props> = ({ info }) => {
16 const anchorRef = useRef<HTMLDivElement>(null);
17 const handleClick = () => setTimeout(() => anchorRef?.current?.scrollIntoView({ behavior: 'smooth' }), 50);
24 className="pt-2 text-sm"
26 <CollapsibleHeaderIconButton className="p-0" onClick={handleClick}>
27 <Icon name="chevron-down" className="color-weak" />
28 </CollapsibleHeaderIconButton>
31 <span className="flex items-center color-weak text-semibold">
32 <Icon className="mr-2" name="info-circle" />
33 <span>{c('Button').t`More info`}</span>
36 <CollapsibleContent className="color-weak pt-4 text-sm">
37 {info.map(({ label, values }, idx) => (
40 key={`${label}-${idx}`}
41 {...(idx === info.length - 1 ? { ref: anchorRef } : {})}
43 <div className="mr-6 text-right w-custom" style={{ '--w-custom': '5rem' }}>{`${label}:`}</div>
44 <div className="flex-1 text-break">
45 {values.map((value) => (
46 <div key={value}>{value}</div>