openreplay/frontend/app/components/shared/SessionItem/MetaMoreButton/MetaMoreButton.tsx
2025-03-07 17:12:45 +01:00

37 lines
944 B
TypeScript

import React from 'react';
import { Popover } from 'UI';
import { Button } from 'antd';
import MetaItem from '../MetaItem';
import { useTranslation } from 'react-i18next';
interface Props {
list: any[];
maxLength: number;
}
export default function MetaMoreButton(props: Props) {
const { list, maxLength } = props;
const { t } = useTranslation();
return (
<Popover
render={() => (
<div
className="text-sm grid grid-col gap-3 bg-white"
style={{ maxHeight: '200px', overflowY: 'auto' }}
>
{list.slice(maxLength).map(({ label, value }, index) => (
<MetaItem key={index} label={label} value={value} />
))}
</div>
)}
placement="bottom"
>
<div className="flex items-center">
<Button type="link">
+{list.length - maxLength}
{' '}
{t('More')}
</Button>
</div>
</Popover>
);
}