Skip to content

Commit 92fd08a

Browse files
committed
fix: pass simple CSS variable to ProgressBar root style
1 parent ccfd5b9 commit 92fd08a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/components/Attachment/__tests__/__snapshots__/Card.test.js.snap

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ exports[`Card theme V2 (1) should render card without caption if attachment type
5959
data-progress="0"
6060
data-testid="audio-progress"
6161
role="progressbar"
62+
style="--str-chat__message-attachment-audio-widget-progress: 0%;"
6263
>
6364
<div
6465
class="str-chat__message-attachment-audio-widget--progress-slider"
@@ -282,6 +283,7 @@ exports[`Card theme V2 (7) should render audio with caption using og_scrape_url
282283
data-progress="0"
283284
data-testid="audio-progress"
284285
role="progressbar"
286+
style="--str-chat__message-attachment-audio-widget-progress: 0%;"
285287
>
286288
<div
287289
class="str-chat__message-attachment-audio-widget--progress-slider"
@@ -493,6 +495,7 @@ exports[`Card theme V2 (10) should render audio without title if attachment type
493495
data-progress="0"
494496
data-testid="audio-progress"
495497
role="progressbar"
498+
style="--str-chat__message-attachment-audio-widget-progress: 0%;"
496499
>
497500
<div
498501
class="str-chat__message-attachment-audio-widget--progress-slider"
@@ -689,6 +692,7 @@ exports[`Card theme V2 (13) should render audio without title and with caption u
689692
data-progress="0"
690693
data-testid="audio-progress"
691694
role="progressbar"
695+
style="--str-chat__message-attachment-audio-widget-progress: 0%;"
692696
>
693697
<div
694698
class="str-chat__message-attachment-audio-widget--progress-slider"
@@ -872,6 +876,7 @@ exports[`Card theme V2 (16) should render audio widget with title & text in Card
872876
data-progress="0"
873877
data-testid="audio-progress"
874878
role="progressbar"
879+
style="--str-chat__message-attachment-audio-widget-progress: 0%;"
875880
>
876881
<div
877882
class="str-chat__message-attachment-audio-widget--progress-slider"
@@ -1404,6 +1409,7 @@ exports[`Card theme V2 (25) should render audio widget with image loaded from th
14041409
data-progress="0"
14051410
data-testid="audio-progress"
14061411
role="progressbar"
1412+
style="--str-chat__message-attachment-audio-widget-progress: 0%;"
14071413
>
14081414
<div
14091415
class="str-chat__message-attachment-audio-widget--progress-slider"

src/components/Attachment/components/ProgressBar.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ export const ProgressBar = ({ onClick, progress }: ProgressBarProps) => (
1212
data-testid='audio-progress'
1313
onClick={onClick}
1414
role='progressbar'
15-
style={{
16-
background: `linear-gradient(
17-
to right,
18-
var(--str-chat__primary-color),
19-
var(--str-chat__primary-color) ${progress}%,
20-
var(--str-chat__disabled-color) ${progress}%,
21-
var(--str-chat__disabled-color)
22-
)`,
23-
}}
15+
style={
16+
{
17+
'--str-chat__message-attachment-audio-widget-progress': progress + '%',
18+
} as React.CSSProperties
19+
}
2420
>
2521
<div
2622
className='str-chat__message-attachment-audio-widget--progress-slider'

0 commit comments

Comments
 (0)