-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
react/kiez-search-profile: refactor search profile and update alerts
- Loading branch information
1 parent
cd98931
commit 8d96330
Showing
8 changed files
with
287 additions
and
275 deletions.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
### Added | ||
|
||
- Added search profile alerts to plan list page. | ||
- Added search profile alerts to `ProjectsListMapBox` component. | ||
- Added `DeleteModal` to `SearchProfile` component. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { useEffect, useRef } from 'react' | ||
import django from 'django' | ||
|
||
const closeText = django.gettext('Close') | ||
const deleteText = django.gettext('Delete') | ||
|
||
export default function DeleteModal ({ title, message, onDelete, onClose }) { | ||
const dialogRef = useRef(null) | ||
|
||
const closeModal = () => { | ||
if (dialogRef.current) { | ||
dialogRef.current.close() | ||
onClose() | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
if (dialogRef.current) { | ||
dialogRef.current.showModal() | ||
} | ||
}, []) | ||
|
||
return ( | ||
<dialog | ||
className="kiezradar__modal" | ||
ref={dialogRef} | ||
aria-labelledby="modal-title" | ||
onKeyDown={(event) => { | ||
if (event.key === 'Escape') closeModal() | ||
}} | ||
> | ||
<button type="button" className="kiezradar__modal-close" aria-label={closeText} onClick={closeModal}> | ||
<span className="fa fa-times" aria-hidden="true" /> | ||
</button> | ||
<h3 id="modal-title" className="kiezradar__modal-title">{title}</h3> | ||
<p className="kiezradar__modal-text">{message}</p> | ||
<div className="kiezradar__modal-buttons"> | ||
<button className="link" onClick={closeModal}> | ||
{closeText} | ||
</button> | ||
<button className="button kiezradar__modal-button-open" onClick={onDelete}> | ||
{deleteText} | ||
</button> | ||
</div> | ||
</dialog> | ||
) | ||
} |
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.