Skip to content

Commit 8d1e838

Browse files
committed
add scroll notification and make it so passcode works even if wrong passcode
1 parent c13eed1 commit 8d1e838

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

src/pages/LinksGrid.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,46 @@
199199
height: 100%;
200200
}
201201

202+
.scroll-notification {
203+
position: fixed;
204+
bottom: 20px;
205+
left: 50%;
206+
transform: translateX(-50%);
207+
background-color: #5865f2;
208+
color: white;
209+
padding: 12px 24px;
210+
border-radius: 8px;
211+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
212+
z-index: 1000;
213+
animation: slideUp 0.3s ease-out, fadeOut 0.3s ease-out 2.7s;
214+
display: flex;
215+
align-items: center;
216+
gap: 8px;
217+
font-size: 1rem;
218+
}
219+
220+
@keyframes slideUp {
221+
from {
222+
transform: translate(-50%, 100%);
223+
opacity: 0;
224+
}
225+
226+
to {
227+
transform: translate(-50%, 0);
228+
opacity: 1;
229+
}
230+
}
231+
232+
@keyframes fadeOut {
233+
from {
234+
opacity: 1;
235+
}
236+
237+
to {
238+
opacity: 0;
239+
}
240+
}
241+
202242
.links-grid {
203243
display: grid;
204244
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));

src/pages/LinksGrid.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function LinksGrid() {
1313
const [linkToDelete, setLinkToDelete] = useState(null);
1414
const [selectedUrl, setSelectedUrl] = useState(null);
1515
const [isFullscreen, setIsFullscreen] = useState(false);
16+
const [showScrollNotification, setShowScrollNotification] = useState(false);
1617

1718
const correctPasscode = 'reactjsforthewin';
1819

@@ -138,6 +139,14 @@ function LinksGrid() {
138139

139140
const handleLinkClick = (url) => {
140141
setSelectedUrl(url);
142+
setShowScrollNotification(true);
143+
setTimeout(() => {
144+
const embedWrapper = document.querySelector('.embed-wrapper');
145+
if (embedWrapper) {
146+
embedWrapper.scrollIntoView({ behavior: 'smooth' });
147+
setTimeout(() => setShowScrollNotification(false), 3000);
148+
}
149+
}, 100);
141150
};
142151

143152
const handleFullscreen = () => {
@@ -258,7 +267,7 @@ function LinksGrid() {
258267
<div
259268
key={index}
260269
className="link-card"
261-
onClick={isAuthenticated ? () => handleLinkClick(link.url) : () => setShowError(true)}
270+
onClick={() => handleLinkClick(link.url)}
262271
>
263272
<h3 className="link-name">{link.name}</h3>
264273
<p className="link-description">{link.description}</p>
@@ -284,6 +293,11 @@ function LinksGrid() {
284293
</div>
285294
))}
286295
</div>
296+
{showScrollNotification && (
297+
<div className="scroll-notification">
298+
📥 Scroll down to view the embedded content
299+
</div>
300+
)}
287301
{selectedUrl && (
288302
<div className="embed-wrapper">
289303
<div id="embed-container" className="embed-container">

0 commit comments

Comments
 (0)