-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Consolidate 3 modals into BaseNotificationModal #2570
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b53da86
Consolidate 3 modals with very similar JSX; convert to Restart UI Modal
hannahpurcell 353d04a
I overcommitted (story of my life)
hannahpurcell 87246c9
Missed import rename
hannahpurcell 4d7e99c
Revert unneeded mocks in Chelsea Bridge modals
hannahpurcell 485a95a
Remove unneeded classname
hannahpurcell 65b5afa
Revert reliance on react-test-renderer, instead migrate to testing-li…
hannahpurcell 86a54d0
Destructure baseElement from render
hannahpurcell d74931a
Migrated from react-test-renderer in modal.test.tsx
hannahpurcell 4a1188c
Merge branch 'main' into hp/consolidate-notification-modals
hannahpurcell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.c-basic-notification-modal { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.c-basic-notification-modal__close-button { | ||
width: 1rem; | ||
margin-left: auto; | ||
} | ||
|
||
.c-basic-notification-modal__body { | ||
margin-top: 1rem; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
assets/src/components/notificationModals/basicNotificationModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useContext } from "react" | ||
import { Modal } from "@restart/ui" | ||
import { setNotification } from "../../state" | ||
import { StateDispatchContext } from "../../contexts/stateDispatchContext" | ||
import { OldCloseIcon } from "../../helpers/icon" | ||
|
||
const BasicNotificationModal = ({ | ||
title, | ||
body, | ||
}: { | ||
title: string | ||
body: string | ||
}) => { | ||
const [, dispatch] = useContext(StateDispatchContext) | ||
|
||
const closeModal = () => { | ||
dispatch(setNotification()) | ||
} | ||
|
||
return ( | ||
<Modal | ||
className="c-modal" | ||
show | ||
renderBackdrop={(props) => ( | ||
<div {...props} className="c-modal-backdrop" /> | ||
)} | ||
> | ||
<div className="c-basic-notification-modal"> | ||
{/* TODO: Close button IS tab-able, but not visually given focus */} | ||
<button | ||
title="Close" | ||
className="c-basic-notification-modal__close-button" | ||
onClick={closeModal} | ||
> | ||
<OldCloseIcon /> | ||
</button> | ||
<div>{title}</div> | ||
<div className="c-basic-notification-modal__body">{body}</div> | ||
</div> | ||
</Modal> | ||
) | ||
} | ||
|
||
export default BasicNotificationModal |
30 changes: 6 additions & 24 deletions
30
assets/src/components/notificationModals/chelseaLoweredNotificationModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting a bit late here, but did you mean for this to be
Basic
orBase
?I only ask because the title of the PR says
Base
, and that's what I would normally have expected.