Skip to content

Commit

Permalink
Dropdown in dropdown (#8911)
Browse files Browse the repository at this point in the history
Dropdown in dropdown bug
while still fixing scroll issue 
fix #8716
  • Loading branch information
guillim authored Dec 5, 2024
1 parent f60ce38 commit 4623b61
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import styled from '@emotion/styled';

const StyledDropdownMenuItemsExternalContainer = styled.div<{
Expand Down Expand Up @@ -26,6 +27,10 @@ const StyledDropdownMenuItemsInternalContainer = styled.div`
width: 100%;
`;

const StyledScrollWrapper = styled(ScrollWrapper)`
width: 100%;
`;

// TODO: refactor this, the dropdown should handle the max height behavior + scroll with the size middleware
// We should instead create a DropdownMenuItemsContainerScrollable or take for granted that it is the default behavior
export const DropdownMenuItemsContainer = ({
Expand All @@ -42,9 +47,17 @@ export const DropdownMenuItemsContainer = ({
hasMaxHeight={hasMaxHeight}
className={className}
>
<StyledDropdownMenuItemsInternalContainer>
{children}
</StyledDropdownMenuItemsInternalContainer>
{hasMaxHeight ? (
<StyledScrollWrapper contextProviderName="dropdownMenuItemsContainer">
<StyledDropdownMenuItemsInternalContainer>
{children}
</StyledDropdownMenuItemsInternalContainer>
</StyledScrollWrapper>
) : (
<StyledDropdownMenuItemsInternalContainer>
{children}
</StyledDropdownMenuItemsInternalContainer>
)}
</StyledDropdownMenuItemsExternalContainer>
);
};

0 comments on commit 4623b61

Please sign in to comment.