Skip to content

Commit

Permalink
fix: take into account header and input when recalculating webchat di…
Browse files Browse the repository at this point in the history
…mensions
  • Loading branch information
vanbasten17 committed Oct 25, 2024
1 parent f9d4f76 commit c6ada97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ export const useWebchatDimensions = () => {
const headerElement = headerRef.current
const inputPanelElement = inputPanelRef.current

if (
!isWebchatOpen ||
!webchatElement ||
!headerElement ||
!inputPanelElement
)
return 0
if (!isWebchatOpen || !webchatElement) return 0

const headerElementHeight = headerElement ? headerElement.clientHeight : 0
const inputPanelElementHeight = inputPanelElement
? inputPanelElement.clientHeight
: 0

return (
webchatElement.clientHeight -
headerElement.clientHeight -
inputPanelElement.clientHeight
headerElementHeight -
inputPanelElementHeight
)
}, [isWebchatOpen])

Expand Down
1 change: 1 addition & 0 deletions packages/botonic-react/src/webchat/webchat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const StyledWebchat = styled.div`
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
`

const ErrorMessageContainer = styled.div`
Expand Down

0 comments on commit c6ada97

Please sign in to comment.