Skip to content

Commit fa52b68

Browse files
committed
Feat: Implement enhanced file/folder CRUD with ConfirmationModal
1 parent 036f13a commit fa52b68

4 files changed

Lines changed: 388 additions & 31 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
.overlay {
2+
position: fixed;
3+
top: 0;
4+
left: 0;
5+
right: 0;
6+
bottom: 0;
7+
background-color: rgba(0, 0, 0, 0.5);
8+
display: flex;
9+
align-items: center;
10+
justify-content: center;
11+
z-index: 1000;
12+
backdrop-filter: blur(4px);
13+
animation: fadeIn 0.2s ease-out;
14+
}
15+
16+
.modal {
17+
background: white;
18+
border-radius: 12px;
19+
width: 90%;
20+
max-width: 450px;
21+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
22+
overflow: hidden;
23+
animation: slideUp 0.3s ease-out;
24+
}
25+
26+
.header {
27+
padding: 1.25rem 1.5rem;
28+
border-bottom: 1px solid #e5e7eb;
29+
display: flex;
30+
justify-content: space-between;
31+
align-items: center;
32+
}
33+
34+
.title {
35+
margin: 0;
36+
font-size: 1.25rem;
37+
font-weight: 600;
38+
color: #111827;
39+
}
40+
41+
.closeBtn {
42+
background: none;
43+
border: none;
44+
cursor: pointer;
45+
color: #9ca3af;
46+
padding: 0.25rem;
47+
border-radius: 4px;
48+
transition: all 0.2s;
49+
}
50+
51+
.closeBtn:hover {
52+
background: #f3f4f6;
53+
color: #4b5563;
54+
}
55+
56+
.content {
57+
padding: 1.5rem;
58+
}
59+
60+
.message {
61+
margin: 0;
62+
color: #4b5563;
63+
line-height: 1.5;
64+
font-size: 1rem;
65+
white-space: pre-line;
66+
}
67+
68+
.footer {
69+
padding: 1.25rem 1.5rem;
70+
background: #f9fafb;
71+
border-top: 1px solid #e5e7eb;
72+
display: flex;
73+
justify-content: flex-end;
74+
gap: 0.75rem;
75+
}
76+
77+
.iconDanger {
78+
color: #dc2626;
79+
}
80+
81+
@keyframes fadeIn {
82+
from {
83+
opacity: 0;
84+
}
85+
86+
to {
87+
opacity: 1;
88+
}
89+
}
90+
91+
@keyframes slideUp {
92+
from {
93+
transform: translateY(20px);
94+
opacity: 0;
95+
}
96+
97+
to {
98+
transform: translateY(0);
99+
opacity: 1;
100+
}
101+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"use client";
2+
3+
import { X, AlertTriangle } from "lucide-react";
4+
import styles from "./ConfirmationModal.module.css";
5+
import React from 'react';
6+
7+
interface ConfirmationModalProps {
8+
isOpen: boolean;
9+
onClose: () => void;
10+
onConfirm: () => void;
11+
title: string;
12+
message: string;
13+
confirmText?: string;
14+
cancelText?: string;
15+
isDanger?: boolean;
16+
}
17+
18+
export default function ConfirmationModal({
19+
isOpen,
20+
onClose,
21+
onConfirm,
22+
title,
23+
message,
24+
confirmText = "Confirm",
25+
cancelText = "Cancel",
26+
isDanger = false
27+
}: ConfirmationModalProps) {
28+
if (!isOpen) return null;
29+
30+
return (
31+
<div className={styles.overlay}>
32+
<div className={styles.modal}>
33+
<div className={styles.header}>
34+
<div style={{ display: "flex", alignItems: "center", gap: "0.75rem" }}>
35+
{isDanger && <AlertTriangle className={styles.iconDanger} size={24} />}
36+
<h3 className={styles.title}>{title}</h3>
37+
</div>
38+
<button onClick={onClose} className={styles.closeBtn}>
39+
<X size={20} />
40+
</button>
41+
</div>
42+
43+
<div className={styles.content}>
44+
<p className={styles.message}>{message}</p>
45+
</div>
46+
47+
<div className={styles.footer}>
48+
<button onClick={onClose} className="btn btn-outline">
49+
{cancelText}
50+
</button>
51+
<button
52+
onClick={() => {
53+
onConfirm();
54+
onClose();
55+
}}
56+
className={`btn ${isDanger ? 'btn-danger' : 'btn-primary'}`}
57+
style={isDanger ? { backgroundColor: "#dc2626", color: "white", borderColor: "#dc2626" } : {}}
58+
>
59+
{confirmText}
60+
</button>
61+
</div>
62+
</div>
63+
</div>
64+
);
65+
}

src/components/dashboard/MyNotes.module.css

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,46 @@
22
margin-top: 3rem;
33
}
44

5+
.header {
6+
display: flex;
7+
justify-content: space-between;
8+
align-items: center;
9+
margin-bottom: 2rem;
10+
}
11+
12+
.headerActions {
13+
display: flex;
14+
gap: 1rem;
15+
}
16+
517
.title {
618
font-size: 1.5rem;
7-
font-weight: 600;
8-
margin-bottom: 1.5rem;
9-
color: var(--text-main);
19+
font-weight: 700;
20+
color: #111827;
21+
}
22+
23+
.createBtn {
1024
display: flex;
1125
align-items: center;
1226
gap: 0.5rem;
27+
padding: 0.5rem 1rem;
28+
background-color: white;
29+
border: 1px solid #e5e7eb;
30+
border-radius: 6px;
31+
font-size: 0.9rem;
32+
font-weight: 500;
33+
color: #374151;
34+
cursor: pointer;
35+
transition: all 0.2s;
36+
}
37+
38+
.createBtn:hover {
39+
background-color: #f9fafb;
40+
border-color: #d1d5db;
41+
}
42+
43+
.hiddenInput {
44+
display: none;
1345
}
1446

1547
.grid {

0 commit comments

Comments
 (0)