feat: display Links field as Expandable List (#5374)

Closes #5114
This commit is contained in:
Thaïs
2024-05-15 15:52:23 +02:00
committed by GitHub
parent 38eb293b3c
commit 602d5422a2
23 changed files with 440 additions and 454 deletions

View File

@ -2,10 +2,13 @@ import styled from '@emotion/styled';
import { ActivityTargetWithTargetRecord } from '@/activities/types/ActivityTargetObject';
import { RecordChip } from '@/object-record/components/RecordChip';
import {
ExpandableList,
ExpandableListProps,
} from '@/ui/layout/expandable-list/components/ExpandableList';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
type ActivityTargetChipsProps = {
activityTargetObjectRecords: ActivityTargetWithTargetRecord[];
anchorElement?: HTMLElement;
maxWidth?: number;
};
const StyledContainer = styled.div<{ maxWidth?: number }>`
display: flex;
@ -16,20 +19,12 @@ const StyledContainer = styled.div<{ maxWidth?: number }>`
export const ActivityTargetChips = ({
activityTargetObjectRecords,
isHovered,
reference,
anchorElement,
maxWidth,
}: {
activityTargetObjectRecords: ActivityTargetWithTargetRecord[];
maxWidth?: number;
} & ExpandableListProps) => {
}: ActivityTargetChipsProps) => {
return (
<StyledContainer maxWidth={maxWidth}>
<ExpandableList
isHovered={isHovered}
reference={reference}
forceDisplayHiddenCount
>
<ExpandableList anchorElement={anchorElement} isChipCountDisplayed>
{activityTargetObjectRecords.map(
(activityTargetObjectRecord, index) => (
<RecordChip