Skip to content

Commit

Permalink
fix: modal popup should be grouped with toggle button
Browse files Browse the repository at this point in the history
  • Loading branch information
alangsto committed Jan 24, 2024
1 parent f706d72 commit 74139b8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 40 deletions.
70 changes: 35 additions & 35 deletions src/components/ToggleXpertButton/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,47 +72,48 @@ const ToggleXpert = ({
&& (localStorage.getItem('completedLearningAssistantTour') || !isModalOpen)
);

const chatMargin = contentToolsEnabled ? 'mb-5' : 'mb-3';

return (
(!isOpen && (
<>
<div
className="position-fixed learning-assistant-popup-modal"
>
<ModalPopup
hasArrow
placement="left"
positionRef={target}
isOpen={isModalOpen && !localStorage.getItem('completedLearningAssistantTour')}
onClose={handleModalClose}
>
<div
className="bg-white p-3 rounded shadow border"
style={{ textAlign: 'start' }}
>
<p data-testid="modal-message">
Xpert is a new part of your learning experience.<br />
You can ask questions and get tutoring help during your course.
</p>
<div className="d-flex justify-content-start" style={{ gap: '10px' }}>
<ModalCloseButton variant="outline-primary" data-testid="close-button">Close</ModalCloseButton>
<Button
variant="primary"
className="mie-2"
onClick={handleClick}
data-testid="check-button"
>
Check it out
</Button>
</div>
</div>
</ModalPopup>
</div>
<div
className={
`toggle position-fixed closed d-flex flex-column justify-content-end align-items-end mx-3 border-0
${contentToolsEnabled ? 'chat-content-tools-margin' : ''}`
${chatMargin}`
}
>
<div
className="position-fixed learning-assistant-popup-modal mb-7"
>
<ModalPopup
hasArrow
placement="left"
positionRef={target}
isOpen={isModalOpen && !localStorage.getItem('completedLearningAssistantTour')}
onClose={handleModalClose}
>
<div
className={`bg-white p-3 rounded shadow border ${chatMargin}`}
style={{ textAlign: 'start' }}
>
<p data-testid="modal-message">
Xpert is a new part of your learning experience.<br />
You can ask questions and get tutoring help during your course.
</p>
<div className="d-flex justify-content-start" style={{ gap: '10px' }}>
<ModalCloseButton variant="outline-primary" data-testid="close-button">Close</ModalCloseButton>
<Button
variant="primary"
className="mie-2"
onClick={handleClick}
data-testid="check-button"
>
Check it out
</Button>
</div>
</div>
</ModalPopup>
</div>
{ shouldDisplayCTA && (
<div
className="d-flex justify-content-end flex-row "
Expand Down Expand Up @@ -153,7 +154,6 @@ const ToggleXpert = ({
<XpertLogo />
</Button>
</div>
</>
))
);
};
Expand Down
5 changes: 0 additions & 5 deletions src/components/ToggleXpertButton/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
height: 1.5rem !important;
}

// this class is used to shift the display of the toggle to account for the display of content tools
.chat-content-tools-margin {
margin-bottom: 2rem;
}

.learning-assistant-popup-modal {
width: 100%;
}

0 comments on commit 74139b8

Please sign in to comment.