Skip to content

Commit 9773df0

Browse files
committed
Refactor breathing animation to use dynamic text transitions with letter-spacing effects
1 parent 99dd343 commit 9773df0

2 files changed

Lines changed: 79 additions & 5 deletions

File tree

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

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,41 @@
8181
animation: exhale 5s linear forwards;
8282
}
8383

84-
&__breathing-status {
84+
&__breathing {
85+
position: relative;
8586
color: var(--cwc-text-color-dimmed);
87+
width: 60px;
88+
height: 100%;
89+
90+
&__text {
91+
position: absolute;
92+
top: 0;
93+
right: 0;
94+
height: 100%;
95+
display: flex;
96+
align-items: center;
97+
opacity: 0;
98+
transition: opacity 1s var(--transition-timing-function);
99+
&--active {
100+
opacity: 1;
101+
}
102+
103+
&--inhale {
104+
letter-spacing: 2px;
105+
106+
&.heading__breathing__text--active {
107+
animation: inhale-spacing 5s linear forwards;
108+
}
109+
}
110+
111+
&--exhale {
112+
letter-spacing: 0px;
113+
114+
&.heading__breathing__text--active {
115+
animation: exhale-spacing 5s linear forwards;
116+
}
117+
}
118+
}
86119
}
87120
}
88121

@@ -219,3 +252,21 @@
219252
background-size: 0% 100%;
220253
}
221254
}
255+
256+
@keyframes inhale-spacing {
257+
from {
258+
letter-spacing: 0px;
259+
}
260+
to {
261+
letter-spacing: 2px;
262+
}
263+
}
264+
265+
@keyframes exhale-spacing {
266+
from {
267+
letter-spacing: 2px;
268+
}
269+
to {
270+
letter-spacing: 0px;
271+
}
272+
}

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

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,36 @@ export const ApiManagerModal: React.FC<Props> = (props) => {
9494
<div
9595
className={cn(styles.heading, {
9696
[styles['heading--scrolled']]: is_scrolled,
97-
[styles['heading--inhale']]: breathing_state === 'inhale',
98-
[styles['heading--exhale']]: breathing_state === 'exhale'
97+
[styles['heading--inhale']]: breathing_state == 'inhale',
98+
[styles['heading--exhale']]: breathing_state == 'exhale'
9999
})}
100100
>
101101
<div className={styles.heading__title}>API Manager</div>
102-
<div className={styles['heading__breathing-status']}>
103-
{breathing_state.toUpperCase()}
102+
<div className={styles['heading__breathing']}>
103+
<span
104+
className={cn(
105+
styles['heading__breathing__text'],
106+
styles['heading__breathing__text--inhale'],
107+
{
108+
[styles['heading__breathing__text--active']]:
109+
breathing_state == 'inhale'
110+
}
111+
)}
112+
>
113+
INHALE
114+
</span>
115+
<span
116+
className={cn(
117+
styles['heading__breathing__text'],
118+
styles['heading__breathing__text--exhale'],
119+
{
120+
[styles['heading__breathing__text--active']]:
121+
breathing_state == 'exhale'
122+
}
123+
)}
124+
>
125+
EXHALE
126+
</span>
104127
</div>
105128
</div>
106129
<Scrollable max_height="25vh" on_scrolled_change={set_is_scrolled}>

0 commit comments

Comments
 (0)