Skip to content

Commit d8178ff

Browse files
Transform same-file CSS variables use to SCSS variables
1 parent 69963c1 commit d8178ff

13 files changed

Lines changed: 63 additions & 86 deletions

File tree

src/components/AIStateIndicator/styling/AIStateIndicator.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.str-chat__ai-state-indicator-container {
22
padding: 0 8px;
3-
background-color: var(--background-core-surface);
3+
background-color: var(--background-core-surface-default);
44
}
55

66
.str-chat__ai-state-indicator-text {

src/components/Attachment/styling/Giphy.scss

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
@use '../../../styling/utils' as utils;
22

3-
.str-chat {
4-
/* The height of GIFs */
5-
--str-chat__gif-height: 200px;
6-
}
3+
$gif-height: 200px;
74

85
.str-chat__message-attachment-giphy {
96
position: relative;
@@ -26,7 +23,7 @@
2623
}
2724

2825
.str-chat__image-placeholder {
29-
height: var(--str-chat__gif-height);
26+
height: $gif-height;
3027
width: var(--str-chat__attachment-max-width);
3128
}
3229
}
@@ -54,10 +51,10 @@
5451

5552
.str-chat__message-attachment--giphy--actions {
5653
.str-chat__message-attachment-giphy {
57-
height: var(--str-chat__gif-height);
54+
height: $gif-height;
5855

5956
img.str-chat__base-image {
60-
height: var(--str-chat__gif-height);
57+
height: $gif-height;
6158
}
6259
}
6360

src/components/Channel/styling/Channel.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
}
182182

183183
@mixin channel-loading-shimmer {
184-
background-color: var(--background-core-surface);
184+
background-color: var(--background-core-surface-default);
185185
background-image: linear-gradient(
186186
90deg,
187187
var(--skeleton-loading-base) 0%,

src/components/ChatView/styling/ChatView.scss

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
--str-chat__chat-view-selector-mobile-width: calc(
66
var(--spacing-md) + var(--spacing-md) + var(--spacing-xs) + var(--spacing-xs) + 20px
77
);
8-
9-
--str-chat-selector-button-color-default: var(--text-tertiary);
10-
--str-chat-selector-button-color-selected: var(--text-primary);
118
}
129

1310
.str-chat__chat-view {
@@ -39,10 +36,7 @@
3936
}
4037

4138
.str-chat__chat-view__selector-button {
42-
--str-chat-icon-height: 20px;
43-
--str-chat-icon-width: 20px;
4439
--str-chat-unread-count-badge-absolute-offset-vertical: 25%;
45-
--str-chat-icon-color: var(--str-chat-selector-button-color-default);
4640

4741
gap: 4px;
4842
padding: var(--spacing-xs);
@@ -52,17 +46,16 @@
5246
position: relative;
5347

5448
background: transparent;
55-
color: var(--str-chat-selector-button-color-default);
49+
color: var(--text-tertiary);
5650

5751
&[aria-selected='true'] {
58-
--str-chat-icon-color: var(--str-chat-selector-button-color-selected);
59-
color: var(--str-chat-selector-button-color-selected);
60-
background: var(--background-core-surface);
52+
color: var(--text-primary);
53+
background: var(--background-core-surface-default);
6154
}
6255

63-
svg {
64-
height: var(--str-chat-icon-height);
65-
width: var(--str-chat-icon-height);
56+
.str-chat__icon {
57+
height: var(--icon-size-md);
58+
width: var(--icon-size-md);
6659
}
6760

6861
.str-chat__button__content {
Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
// Ported from stream-chat-css DragAndDropContainer (layout + theme)
22

3-
.str-chat {
4-
/* Top border of the component */
5-
--str-chat__drag-and-drop-container-border-block-start: 2px solid transparent;
6-
7-
/* Bottom border of the component */
8-
--str-chat__drag-and-drop-container-border-block-end: 2px solid transparent;
9-
10-
/* Left (right in RTL layout) border of the component on dragover */
11-
--str-chat__drag-and-drop-container-on-dragover-border-inline-start: none;
12-
13-
/* Right (left in RTL layout) border of the component on dragover */
14-
--str-chat__drag-and-drop-container-on-dragover-border-inline-end: none;
15-
}
3+
$drag-and-drop-container-border-block-start: 2px solid transparent;
164

175
.str-chat__drag-and-drop-container--dragging {
186
cursor: grabbing;
@@ -30,14 +18,14 @@
3018
display: flex;
3119
width: 100%;
3220
padding-block: 0.25rem;
33-
border-bottom: var(--str-chat__drag-and-drop-container-border-block-start);
34-
border-top: var(--str-chat__drag-and-drop-container-border-block-start);
21+
border-block-start: $drag-and-drop-container-border-block-start;
22+
border-block-end: $drag-and-drop-container-border-block-start;
3523

3624
&.str-chat__drag-and-drop-container__item--dragged-over-from-top {
37-
border-bottom: 2px solid var(--accent-primary);
25+
border-block-end: 2px solid var(--accent-primary);
3826
}
3927

4028
&.str-chat__drag-and-drop-container__item--dragged-over-from-bottom {
41-
border-top: 2px solid var(--accent-primary);
29+
border-block-start: 2px solid var(--accent-primary);
4230
}
4331
}

src/components/Form/styling/SwitchField.scss

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
// Single row: [label / title+description] [optional expanded content] [toggle]
33
// CSS variables aligned with Figma tokens; fallbacks from get_variable_defs.
44

5+
$switch-field-track-height: 24px;
6+
$switch-field-track-thumb-bg: var(--base-white, #ffffff);
7+
$switch-field-track-radius: var(--button-radius-full, 9999px);
8+
59
.str-chat {
610
--str-chat__switch-field-background-color: var(--background-core-surface-card);
711
--str-chat__switch-field-border-radius: var(--radius-md);
8-
--str-chat__switch-field__track-thumb-bg: var(--base-white, #ffffff);
9-
--str-chat__switch-field__track-height: 24px;
10-
--str-chat__switch-field__track-radius: var(--button-radius-full, 9999px);
1112

1213
.str-chat__form__switch-fieldset {
1314
width: 100%;
@@ -50,18 +51,18 @@
5051
align-items: center;
5152
flex-shrink: 0;
5253
width: 44px;
53-
height: var(--str-chat__switch-field__track-height);
54+
height: $switch-field-track-height;
5455
padding: var(--spacing-xxs);
5556
cursor: pointer;
5657
background-color: var(--control-toggle-switch-bg);
57-
border-radius: var(--str-chat__switch-field__track-radius);
58+
border-radius: $switch-field-track-radius;
5859
transition: background-color 0.2s ease;
5960

6061
&-handle {
61-
width: calc(var(--str-chat__switch-field__track-height) - 8px);
62-
height: calc(var(--str-chat__switch-field__track-height) - 8px);
63-
border-radius: var(--str-chat__switch-field__track-radius);
64-
background-color: var(--str-chat__switch-field__track-thumb-bg);
62+
width: calc($switch-field-track-height - 8px);
63+
height: calc($switch-field-track-height - 8px);
64+
border-radius: $switch-field-track-radius;
65+
background-color: $switch-field-track-thumb-bg;
6566
transition: transform 0.2s ease;
6667
}
6768

@@ -70,7 +71,7 @@
7071
justify-content: flex-end;
7172

7273
.str-chat__form__switch-field__switch-handle {
73-
background-color: var(--str-chat__switch-field__track-thumb-bg);
74+
background-color: $switch-field-track-thumb-bg;
7475
}
7576
}
7677
}

src/components/Loading/styling/LoadingChannels.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@mixin channel-list-item-shimmer {
2-
background-color: var(--background-core-surface);
2+
background-color: var(--background-core-surface-default);
33
background-image: linear-gradient(
44
90deg,
55
var(--skeleton-loading-base) 0%,

src/components/Location/styling/ShareLocationDialog.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@use '../../../styling/utils';
22

3+
$duration-selector-min-width: 120px;
4+
35
.str-chat__share-location-dialog {
46
width: 100%;
57
max-width: 520px;
@@ -30,8 +32,6 @@
3032
.str-chat__live-location-sharing-duration-selector {
3133
padding-inline: calc(var(--spacing-md) - var(--spacing-xs));
3234
padding-bottom: var(--spacing-xs);
33-
--str-chat__duration-selector-min-width: 120px;
34-
3535
.str-chat__live-location-sharing-duration-selector__button {
3636
@include utils.button-reset;
3737
align-items: center;
@@ -41,12 +41,12 @@
4141
cursor: pointer;
4242
display: flex;
4343
justify-content: space-between;
44-
min-width: var(--str-chat__duration-selector-min-width);
44+
min-width: $duration-selector-min-width;
4545
font: var(--str-chat__font-caption-default);
4646
}
4747

4848
.str-chat__context-menu {
49-
min-width: var(--str-chat__duration-selector-min-width);
49+
min-width: $duration-selector-min-width;
5050
}
5151
.str-chat__live-location-sharing-duration-option {
5252
width: 100%;

src/components/Message/styling/Message.scss

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
@use '../../../styling/utils';
22

3+
$message-active-background-color: transparent;
4+
$message-reactions-host-offset-x: calc(var(--spacing-xs) * -1);
5+
36
.str-chat {
47
/* The width/height of the message options button(s) */
58
--str-chat__message-options-button-size: var(--size-32);
6-
--str-chat__message-active-background-color: transparent;
7-
--str-chat__message-reactions-host-offset-x: calc(var(--spacing-xs) * -1);
89
/* The maximum allowed width of the message component */
910
--str-chat__message-max-width: 400px;
1011
/* The maximum allowed width of the message component, if it has attachments */
@@ -273,11 +274,9 @@
273274
}
274275

275276
&:has(.str-chat__message-reactions--top) {
276-
padding-inline-start: calc(
277-
var(--str-chat__message-reactions-host-offset-x) * -1
278-
);
277+
padding-inline-start: calc($message-reactions-host-offset-x * -1);
279278

280-
margin-inline-end: var(--str-chat__message-reactions-host-offset-x);
279+
margin-inline-end: $message-reactions-host-offset-x;
281280
}
282281

283282
.str-chat__message-reactions.str-chat__message-reactions--segmented.str-chat__message-reactions--bottom
@@ -318,9 +317,9 @@
318317
}
319318

320319
&:has(.str-chat__message-reactions--top) {
321-
padding-inline-end: calc(var(--str-chat__message-reactions-host-offset-x) * -1);
320+
padding-inline-end: calc($message-reactions-host-offset-x * -1);
322321

323-
margin-inline-start: var(--str-chat__message-reactions-host-offset-x);
322+
margin-inline-start: $message-reactions-host-offset-x;
324323
}
325324

326325
.str-chat__message-reactions.str-chat__message-reactions--segmented.str-chat__message-reactions--bottom
@@ -534,13 +533,13 @@
534533

535534
/* This rule won't be applied in browsers that don't support :has() */
536535
.str-chat__li:hover:not(:has(.str-chat__reaction-list:hover, .str-chat__modal--open)) {
537-
background-color: var(--str-chat__message-active-background-color);
536+
background-color: $message-active-background-color;
538537
}
539538

540539
/* Fallback for when :has() is unsupported */
541540
@supports not selector(:has(a, b)) {
542541
.str-chat__li:hover {
543-
background-color: var(--str-chat__message-active-background-color);
542+
background-color: $message-active-background-color;
544543
}
545544
}
546545

src/components/MessageComposer/styling/AttachmentPreview.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@use '../../../styling/utils';
22

3+
$attachment-preview-row-height: 72px;
4+
35
.str-chat {
4-
--str-chat__attachment-preview-row-height: 72px;
56
--str-chat__attachment-preview-close-icon-background: var(--control-remove-control-bg);
67
--str-chat__attachment-preview-close-icon-color: var(--control-remove-control-icon);
78
--str-chat__attachment-preview-close-icon-border-color: var(
@@ -59,8 +60,8 @@
5960
width: 100%;
6061
min-width: 0;
6162
max-width: 100%;
62-
min-height: calc(var(--str-chat__attachment-preview-row-height) * 1.2);
63-
max-height: calc(var(--str-chat__attachment-preview-row-height) * 1.7);
63+
min-height: calc($attachment-preview-row-height * 1.2);
64+
max-height: calc($attachment-preview-row-height * 1.7);
6465
overflow-x: hidden;
6566
overflow-y: auto;
6667
flex: 0 1 auto;
@@ -82,7 +83,7 @@
8283
padding: var(--spacing-md);
8384
padding-inline-end: var(--spacing-sm);
8485
width: 290px;
85-
height: var(--str-chat__attachment-preview-row-height);
86+
height: $attachment-preview-row-height;
8687
}
8788

8889
.str-chat__attachment-preview-audio {
@@ -108,8 +109,8 @@
108109
border-radius: var(--message-bubble-radius-attachment);
109110
border: 1px solid var(--border-core-default);
110111
flex: 0 0 auto;
111-
width: var(--str-chat__attachment-preview-row-height);
112-
height: var(--str-chat__attachment-preview-row-height);
112+
width: $attachment-preview-row-height;
113+
height: $attachment-preview-row-height;
113114
cursor: pointer;
114115

115116
.str-chat__attachment-preview-media__thumbnail-wrapper {

0 commit comments

Comments
 (0)