Skip to content

Commit ee19fd9

Browse files
authored
Merge pull request #176 from pirogramming/hyungju/main
feat: MD 복사할 때 토스트 뜨도록 수정
2 parents 3cd2be1 + 0cad693 commit ee19fd9

2 files changed

Lines changed: 74 additions & 3 deletions

File tree

static/css/reflections.css

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,67 @@
3636
}
3737

3838
body {
39-
font-family: inherit; /* 이미 있으면 생략 */
4039
background: #F9F9F9;
4140
}
4241

4342
button {
4443
cursor: pointer;
4544
}
45+
46+
/* 토스트 */
47+
48+
/* 토스트 (테마 맞춘 밝은 카드형 + 상단 슬라이드) */
49+
.ref-toast {
50+
position: fixed;
51+
top: 72px;
52+
left: 50%;
53+
transform: translateX(-50%) translateY(-30px) scale(0.95);
54+
background: #fff;
55+
color: var(--gray-900);
56+
padding: 12px 16px;
57+
58+
border-radius: 9999px;
59+
font-size: 15px;
60+
font-weight: 600;
61+
62+
opacity: 0;
63+
z-index: 9999;
64+
65+
border: 1px solid var(--blue-10);
66+
box-shadow: 0 12px 30px rgba(29, 41, 75, 0.15);
67+
min-width: 220px;
68+
max-width: min(560px, calc(100vw - 24px));
69+
text-align: center;
70+
71+
transition:
72+
transform 0.35s cubic-bezier(.22,1.4,.36,1),
73+
opacity 0.25s ease;
74+
}
75+
76+
.ref-toast.show {
77+
opacity: 1;
78+
transform: translateX(-50%) translateY(0) scale(1);
79+
}
80+
81+
82+
83+
/* 성공: 블루 포인트 */
84+
.ref-toast-success {
85+
border-color: var(--blue-20);
86+
}
87+
.ref-toast-success::before {
88+
content: "✓ ";
89+
font-weight: 800;
90+
font-size: 15px;
91+
padding-left: 5px;
92+
}
93+
94+
/* 실패: 빨간 포인트 */
95+
.ref-toast-error {
96+
border-color: #fca5a5;
97+
}
98+
99+
46100
/* =========================
47101
Note List Page
48102
========================= */

static/js/reflections.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@
1717
});
1818
};
1919

20+
const showToast = (message, type = "success") => {
21+
const toast = document.createElement("div");
22+
toast.className = `ref-toast ref-toast-${type}`;
23+
toast.textContent = message;
24+
25+
document.body.appendChild(toast);
26+
27+
requestAnimationFrame(() => {
28+
toast.classList.add("show");
29+
});
30+
31+
setTimeout(() => {
32+
toast.classList.remove("show");
33+
setTimeout(() => toast.remove(), 300);
34+
}, 2000);
35+
};
36+
2037
/** ---------------------------
2138
* 1) Kebab menu (수정/삭제)
2239
* - 버튼 클릭: 해당 메뉴 토글
@@ -436,10 +453,10 @@
436453

437454
try {
438455
await navigator.clipboard.writeText(ta.value);
439-
alert("마크다운 복사됨");
456+
showToast("마크다운 복사 완료", "success");
440457
} catch (e) {
441458
console.error(e);
442-
alert("복사 실패");
459+
showToast("마크다운 복사 실패", "error");
443460
}
444461
});
445462
});

0 commit comments

Comments
 (0)