Expandable list remove anchor (#5559)

Deprecate anchorElement on ExpandableList to avoid props drilling. The
anchorElement should be the ExpandableList container itself
This commit is contained in:
Charles Bochet
2024-05-24 12:26:42 +02:00
committed by GitHub
parent 7f7ea59b51
commit 82ec30c957
10 changed files with 7 additions and 26 deletions

View File

@ -104,12 +104,7 @@ export const CalendarEventParticipantsResponseStatusField = ({
</StyledLabelAndIconContainer>
<StyledDiv ref={participantsContainerRef}>
{isRightDrawerAnimationCompleted && (
<ExpandableList
anchorElement={participantsContainerRef.current || undefined}
isChipCountDisplayed
>
{styledChips}
</ExpandableList>
<ExpandableList isChipCountDisplayed>{styledChips}</ExpandableList>
)}
</StyledDiv>
</StyledInlineCellBaseContainer>

View File

@ -6,7 +6,6 @@ import { ExpandableList } from '@/ui/layout/expandable-list/components/Expandabl
type ActivityTargetChipsProps = {
activityTargetObjectRecords: ActivityTargetWithTargetRecord[];
anchorElement?: HTMLElement;
maxWidth?: number;
};
@ -19,12 +18,11 @@ const StyledContainer = styled.div<{ maxWidth?: number }>`
export const ActivityTargetChips = ({
activityTargetObjectRecords,
anchorElement,
maxWidth,
}: ActivityTargetChipsProps) => {
return (
<StyledContainer maxWidth={maxWidth}>
<ExpandableList anchorElement={anchorElement} isChipCountDisplayed>
<ExpandableList isChipCountDisplayed>
{activityTargetObjectRecords.map(
(activityTargetObjectRecord, index) => (
<RecordChip

View File

@ -53,9 +53,8 @@ export const ActivityTargetsInlineCell = ({
/>
}
label="Relations"
displayModeContent={({ cellElement }) => (
displayModeContent={() => (
<ActivityTargetChips
anchorElement={cellElement}
activityTargetObjectRecords={activityTargetObjectRecords}
maxWidth={maxWidth}
/>