Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: modal popup should be grouped with toggle button #40

Merged
merged 1 commit into from
Jan 24, 2024
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
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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is the 'mb-5': 'mb-3' something that is hard-coded? Is this okay? Kind of a css newb so if I'm missing something obvious here lemme know haha. I like how you separated this as a const though--looks a lot cleaner! Nice!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bootstrap class (see https://getbootstrap.com/docs/4.0/utilities/spacing/). It's just to accomadate for different margins depending on whether or not the content tools are enabled (and therefore displayed at the bottom of the page).

Before I had additional margin space added, but just as a class. I figured bootstrap would be better!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooooh, cool! Nice! And thanks for clarifying.


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%;
}
Loading