Skip to content

Commit 0f68546

Browse files
committed
Update the ApiManagerModal header with a breathing animation and status indicator
1 parent 888d3ac commit 0f68546

2 files changed

Lines changed: 69 additions & 10 deletions

File tree

‎packages/ui/src/components/editor/panel/modals/ApiManagerModal/ApiManagerModal.module.scss‎

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,50 @@
4040
var(--transition-timing-function);
4141
}
4242

43-
.title {
43+
.heading {
44+
display: flex;
45+
justify-content: space-between;
4446
font-weight: 500;
4547
font-size: 11px;
4648
font-weight: 600;
47-
color: var(--vscode-textLink-foreground);
4849
text-transform: uppercase;
4950
display: flex;
5051
align-items: center;
5152
padding: 0 8px;
5253
height: 28px;
53-
transform: translateY(3px);
54-
transition: transform var(--transition-duration-250)
55-
var(--transition-timing-function);
54+
background-image: linear-gradient(
55+
to right,
56+
var(--cwc-bg-secondary),
57+
var(--cwc-bg-secondary)
58+
);
59+
background-repeat: no-repeat;
60+
background-size: 0% 100%;
61+
62+
> div {
63+
transform: translateY(3px);
64+
transition: transform var(--transition-duration-250)
65+
var(--transition-timing-function);
66+
}
5667

57-
&--scrolled {
58-
transform: unset;
68+
&__title {
69+
color: var(--vscode-textLink-foreground);
70+
}
71+
72+
&--scrolled > span {
5973
transform: translateY(1px);
6074
}
75+
76+
&--inhale {
77+
animation: inhale 5s linear forwards;
78+
}
79+
80+
&--exhale {
81+
animation: exhale 5s linear forwards;
82+
}
83+
84+
&__breathing-status {
85+
color: var(--cwc-text-color-dimmed);
86+
}
6187
}
6288

6389
.requests-container {
@@ -175,3 +201,21 @@
175201
background: transparent;
176202
}
177203
}
204+
205+
@keyframes inhale {
206+
from {
207+
background-size: 0% 100%;
208+
}
209+
to {
210+
background-size: 100% 100%;
211+
}
212+
}
213+
214+
@keyframes exhale {
215+
from {
216+
background-size: 100% 100%;
217+
}
218+
to {
219+
background-size: 0% 100%;
220+
}
221+
}

‎packages/ui/src/components/editor/panel/modals/ApiManagerModal/ApiManagerModal.tsx‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export const ApiManagerModal: React.FC<Props> = (props) => {
3131
const [now, set_now] = useState(Date.now())
3232
const [is_scrolled, set_is_scrolled] = useState(false)
3333
const [window_width, set_window_width] = useState(window.innerWidth)
34+
const [breathing_state, set_breathing_state] = useState<'inhale' | 'exhale'>(
35+
'inhale'
36+
)
3437

3538
useEffect(() => {
3639
const handle_resize = () => set_window_width(window.innerWidth)
@@ -47,6 +50,13 @@ export const ApiManagerModal: React.FC<Props> = (props) => {
4750
return () => clearInterval(interval)
4851
}, [])
4952

53+
useEffect(() => {
54+
const interval = setInterval(() => {
55+
set_breathing_state((prev) => (prev === 'inhale' ? 'exhale' : 'inhale'))
56+
}, 5000)
57+
return () => clearInterval(interval)
58+
}, [])
59+
5060
useEffect(() => {
5161
set_start_times((prev) => {
5262
const next = { ...prev }
@@ -82,11 +92,16 @@ export const ApiManagerModal: React.FC<Props> = (props) => {
8292
>
8393
<div className={styles.container}>
8494
<div
85-
className={cn(styles.title, {
86-
[styles['title--scrolled']]: is_scrolled
95+
className={cn(styles.heading, {
96+
[styles['heading--scrolled']]: is_scrolled,
97+
[styles['heading--inhale']]: breathing_state === 'inhale',
98+
[styles['heading--exhale']]: breathing_state === 'exhale'
8799
})}
88100
>
89-
API Manager
101+
<div className={styles.heading__title}>API Manager</div>
102+
<div className={styles['heading__breathing-status']}>
103+
{breathing_state.toUpperCase()}
104+
</div>
90105
</div>
91106
<Scrollable max_height="25vh" on_scrolled_change={set_is_scrolled}>
92107
<div className={styles['requests-container']}>

0 commit comments

Comments
 (0)