Skip to content

Commit

Permalink
feat: add post title to delete modal
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-ciesielska committed Nov 24, 2023
1 parent 74c941e commit d5287d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ yarn-error.log
.env

.eslintcache
.vscode
6 changes: 3 additions & 3 deletions src/screens/admin/components/blog-posts/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const BlogPost = ({ post, onClickEdit, onDelete }) => {
};

const DeleteModal = ({
handleDelete, isOpen, setIsOpen,
handleDelete, isOpen, setIsOpen, title,
}) => {
const handleClose = () => setIsOpen(false);
const handleOpen = () => setIsOpen(true);
Expand All @@ -44,7 +44,7 @@ const DeleteModal = ({
ariaHideApp={false}
>
<div>
Are you sure you want to delete?
Are you sure you want to delete <span className="delete-blog-post-title">{`"${title}" `}</span>?
<div className="delete-blog-post-buttons">
<button type="button" className="blog-post-button animated-button" onClick={handleDelete}>Yes</button>
<button type="button" className="blog-post-button animated-button" onClick={handleClose}>No</button>
Expand Down Expand Up @@ -105,7 +105,7 @@ const BlogPosts = (props) => {
(post) => <BlogPost post={post} onClickEdit={() => openEditForm(post)} onDelete={() => openDeleteModal(post)} key={post.id} />,
)}
<EditBlogPost isOpen={showEditForm} setIsOpen={setShowEditForm} post={selectedBlogPost} onSubmit={handleFormSubmit} />
<DeleteModal handleDelete={handleDeleteBlogPost} isOpen={showDeleteModal} setIsOpen={setShowDeleteModal} />
<DeleteModal handleDelete={handleDeleteBlogPost} isOpen={showDeleteModal} setIsOpen={setShowDeleteModal} title={selectedBlogPost.title} />

</div>
);
Expand Down
4 changes: 4 additions & 0 deletions src/screens/admin/components/blog-posts/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@
padding-left: 20px;
padding-right: 20px;
}
}

.delete-blog-post-title {
font-style: italic;
}

0 comments on commit d5287d3

Please sign in to comment.