Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
mrigaankzoro committed Oct 31, 2024
1 parent 21d4f24 commit db1f910
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Client/src/pages/FilterNotes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ function FilterNotes() {
subjectsForYear.map((note) => (
<div
key={note.subject}
className="mx-10 flex justify-between items-center w-full p-4 border-2 border-gray-300 mb-2 rounded-lg shadow-md transition-transform transform hover:scale-105"
className="mx-10 flex md:flex-row flex-col justify-between items-start md:items-center w-full p-4 border-2 border-gray-300 mb-2 rounded-lg shadow-md transition-transform transform hover:scale-105"
>
<a
href={note.notesLink}
target="_blank"
rel="noopener noreferrer"
className="text-white font-semibold hover:underline"
className="text-white font-semibold hover:underline text-base md:text-lg"
>
{note.subject}
</a>
<p className="flex items-center text-gray-600 gap-2">
<p className="flex items-center text-gray-400 gap-2 mt-2 md:mt-0 text-sm md:text-base">
<GoPerson className="mt-1" />
{note.author}
</p>
Expand Down
4 changes: 3 additions & 1 deletion Client/src/pages/delete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const DeleteNote = () => {
try {
const response = await fetch(`https://scholarstation.onrender.com/notes/${id}`, { method: 'DELETE' });
if (!response.ok) throw new Error("Error deleting note.");
setNotes(notes.filter(note => note.id !== id));

// After deletion, update the notes state by filtering out the deleted note
setNotes(prevNotes => prevNotes.filter(note => note.id !== id));
} catch (err) {
setError("Error deleting note.");
console.error(err);
Expand Down

0 comments on commit db1f910

Please sign in to comment.