Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dirty-shrimps-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@channel.io/bezier-react": patch
---

Fix to pass missing property of `Overlay` component.
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ export const Overlay = styled.div<StyledOverlayProps>`
foundation?.transition?.TransitionDuration.S,
)
)};

${({ interpolation }) => interpolation}
`
17 changes: 12 additions & 5 deletions packages/bezier-react/src/components/Overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ function Overlay(
enableClickOutside = false,
children,
onHide = noop,
onTransitionEnd = noop,
...rest
}: OverlayProps,
forwardedRef: Ref<any>,
forwardedRef: Ref<HTMLDivElement>,
) {
// NOTE: DOM render 가 필요한지 여부를 결정하는 state
const [shouldRender, setShouldRender] = useState(false)
Expand All @@ -67,7 +69,7 @@ function Overlay(
}, [])

const handleContainerRect = useCallback(() => {
const containerElement = container || getRootElement() as HTMLElement
const containerElement = container || getRootElement()

const {
width: containerWidth,
Expand Down Expand Up @@ -126,11 +128,15 @@ function Overlay(
handleTargetRect,
])

const handleTransitionEnd = useCallback(() => {
const handleTransitionEnd = useCallback<React.TransitionEventHandler<HTMLDivElement>>((event) => {
onTransitionEnd(event)
if (!show) {
setShouldRender(false)
}
}, [show])
}, [
show,
onTransitionEnd,
])

const handleBlockMouseWheel = useCallback((event: HTMLElementEventMap['wheel']) => {
event.stopPropagation()
Expand Down Expand Up @@ -176,6 +182,7 @@ function Overlay(
marginY={marginY}
keepInContainer={keepInContainer}
onTransitionEnd={handleTransitionEnd}
{...rest}
>
{ children }
</Styled.Overlay>
Expand Down Expand Up @@ -276,7 +283,7 @@ function Overlay(

return ReactDOM.createPortal(
overlay,
container || getRootElement() as HTMLElement,
container || getRootElement(),
)
}

Expand Down