-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regression: custom multi select broken layout and fowardRef error (#3…
…0215) Co-authored-by: Guilherme Gazzo <[email protected]>
- Loading branch information
1 parent
93d5a5c
commit 2e2a89e
Showing
5 changed files
with
52 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 11 additions & 15 deletions
26
packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomListWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import { useOutsideClick } from '@rocket.chat/fuselage-hooks'; | ||
import type { ComponentProps } from 'react'; | ||
import { forwardRef, useRef } from 'react'; | ||
import { forwardRef, type ComponentProps } from 'react'; | ||
|
||
const MultiSelectCustomListWrapper = forwardRef<Element, ComponentProps<typeof Box> & { onClose: (e: MouseEvent) => void }>( | ||
function MultiSelectCustomListWrapper({ children, onClose }) { | ||
const target = useRef<HTMLElement>(null); | ||
useOutsideClick([target], onClose); | ||
|
||
return ( | ||
<Box ref={target} zIndex='99999' w='full' position='absolute' mbs='x40' pbs='x4'> | ||
{children} | ||
</Box> | ||
); | ||
}, | ||
); | ||
const MultiSelectCustomListWrapper = forwardRef<Element, ComponentProps<typeof Box>>(function MultiSelectCustomListWrapper( | ||
{ children }, | ||
ref, | ||
) { | ||
return ( | ||
<Box ref={ref} zIndex='2' w='full' position='absolute' mbs={40} pbs={4}> | ||
{children} | ||
</Box> | ||
); | ||
}); | ||
|
||
export default MultiSelectCustomListWrapper; |