Skip to content

Commit

Permalink
fix: 드롭다운이 정상적으로 동작하도록 수정한다
Browse files Browse the repository at this point in the history
  • Loading branch information
jhn3981 committed May 27, 2024
1 parent 7c2a41a commit 2980c6b
Showing 1 changed file with 17 additions and 31 deletions.
48 changes: 17 additions & 31 deletions packages/vibrant-components/src/lib/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import type { Align, Side } from 'packages/vibrant-utils/src/types';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
Box,
PortalBox,
PressableBox,
OverlayBox,
ScrollBox,
ThemeProvider,
getWindowDimensions,
Expand Down Expand Up @@ -192,7 +191,7 @@ export const Dropdown = withDropdownVariation(
spacing
);

setOffset({ x: openerRect.x + offsetX, y: openerRect.y + offsetY });
setOffset({ x: offsetX, y: offsetY });
}

setContentHeight(height);
Expand Down Expand Up @@ -235,32 +234,19 @@ export const Dropdown = withDropdownVariation(
<Box ref={openerRef}>{opener}</Box>
{!isMobile && isOpen && (
<ThemeProvider theme={rootThemeMode}>
<PortalBox zIndex={zIndex.dropdown} top={0} right={0} bottom={0} left={0}>
<PressableBox
as="div"
position="absolute"
cursor="default"
top={0}
right={0}
bottom={0}
left={0}
onClick={closeDropdown}
/>
<Transition
animation={{
opacity: visible ? 1 : 0,
...(visible
? {
x: offset.x,
y: offset.y,
}
: {}),
}}
style={{
x: offset.x,
y: offset.y,
}}
duration={200}
<Transition
animation={{
opacity: visible ? 1 : 0,
}}
duration={200}
>
<OverlayBox
open={isOpen}
onDismiss={closeDropdown}
targetRef={customOpenerRef.current ? customOpenerRef : openerRef}
zIndex={zIndex.dropdown}
top={offset.y}
left={offset.x}
>
<Box alignSelf="flex-start">
<Box
Expand Down Expand Up @@ -291,8 +277,8 @@ export const Dropdown = withDropdownVariation(
</Transition>
</Box>
</Box>
</Transition>
</PortalBox>
</OverlayBox>
</Transition>
</ThemeProvider>
)}
{isMobile && (
Expand Down

0 comments on commit 2980c6b

Please sign in to comment.