Skip to content

Commit d4f3433

Browse files
committed
style: enhance terminal loading user experience
- Added a wrapper for the iframe to manage loading states more effectively. - Introduced new CSS classes for loading and loaded states to enhance user experience. - Updated loading animation styles for better visibility and transitions during iframe loading.
1 parent d835ef9 commit d4f3433

File tree

2 files changed

+49
-7
lines changed

2 files changed

+49
-7
lines changed

src/frontend/src/pad/containers/Terminal.scss

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
overflow: hidden;
77
}
88

9+
.terminal-iframe-wrapper {
10+
position: relative;
11+
flex: 1;
12+
height: 100%;
13+
width: 100%;
14+
overflow: hidden;
15+
border-bottom-left-radius: var(--embeddable-radius);
16+
border-bottom-right-radius: var(--embeddable-radius);
17+
background-color: #000000;
18+
}
19+
920
.terminal-iframe {
1021
flex: 1;
1122
background-color: #000000;
@@ -22,6 +33,16 @@
2233
justify-content: center;
2334
position: relative;
2435
}
36+
37+
&--loading-fade {
38+
opacity: 0;
39+
transition: opacity 0.5s ease-in;
40+
}
41+
42+
&--loaded {
43+
opacity: 1;
44+
transition: opacity 0.5s ease-in;
45+
}
2546
}
2647

2748
.terminal-loading-animation {
@@ -31,6 +52,18 @@
3152
display: flex;
3253
align-items: center;
3354
justify-content: center;
55+
56+
&--fade {
57+
opacity: 1;
58+
transition: opacity 0.15s ease-out;
59+
z-index: 1;
60+
background-color: #000000;
61+
}
62+
63+
&--hidden {
64+
opacity: 0;
65+
pointer-events: none;
66+
}
3467
}
3568

3669
.terminal-loading-logo {

src/frontend/src/pad/containers/Terminal.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export const Terminal: React.FC<TerminalProps> = ({
179179
// Set a small timeout to allow the scrolling to complete first
180180
const timer = setTimeout(() => {
181181
setShouldRenderIframe(true);
182-
}, 500); // 300ms delay should be enough for the scroll animation to start
182+
}, 500);
183183

184184
return () => clearTimeout(timer);
185185
}, []);
@@ -193,12 +193,21 @@ export const Terminal: React.FC<TerminalProps> = ({
193193
return (
194194
<div className="terminal-container">
195195
{shouldRenderIframe ? (
196-
<iframe
197-
className="terminal-iframe"
198-
src={terminalUrl}
199-
title="Terminal"
200-
onLoad={handleIframeLoad}
201-
/>
196+
<div className="terminal-iframe-wrapper">
197+
<iframe
198+
className={`terminal-iframe ${iframeLoaded ? 'terminal-iframe--loaded' : 'terminal-iframe--loading-fade'}`}
199+
src={terminalUrl}
200+
title="Terminal"
201+
onLoad={handleIframeLoad}
202+
/>
203+
<div className={`terminal-loading-animation terminal-loading-animation--fade ${iframeLoaded ? 'terminal-loading-animation--hidden' : ''}`}>
204+
<img
205+
src="/assets/images/favicon.png"
206+
alt="pad.ws logo"
207+
className="terminal-loading-logo"
208+
/>
209+
</div>
210+
</div>
202211
) : (
203212
<div className="terminal-iframe terminal-iframe--loading">
204213
<div className="terminal-loading-animation">

0 commit comments

Comments
 (0)