Skip to content

Commit 7c978a9

Browse files
fix: change class names to reflect component renames (#3035)
### 🎯 Goal # Class Name Renames (SCSS + TSX) ## ChannelListItem/styling/ChannelListItem.scss | Old Class Name | New Class Name | | --------------------------------------------------------- | ----------------------------------------------------------- | | `.str-chat__channel-preview-container` | `.str-chat__channel-list-item-container` | | `.str-chat__channel-preview__action-buttons--active` | `.str-chat__channel-list-item__action-buttons--active` | | `.str-chat__channel-preview__action-buttons` | `.str-chat__channel-list-item__action-buttons` | | `.str-chat__channel-preview__action-buttons-context-menu` | `.str-chat__channel-list-item__action-buttons-context-menu` | | `.str-chat__channel-preview` | `.str-chat__channel-list-item` | | `.str-chat__channel-preview-data` | `.str-chat__channel-list-item-data` | | `.str-chat__channel-preview-data__first-row` | `.str-chat__channel-list-item-data__first-row` | | `.str-chat__channel-preview-data__title` | `.str-chat__channel-list-item-data__title` | | `.str-chat__channel-preview-data__timestamp-and-badge` | `.str-chat__channel-list-item-data__timestamp-and-badge` | | `.str-chat__channel-preview-timestamp` | `.str-chat__channel-list-item-timestamp` | ## Loading/styling/LoadingChannels.scss | Old Class Name | New Class Name | | ------------------------------------------ | -------------------------------------------- | | `.str-chat__channel-preview--loading` | `.str-chat__channel-list-item--loading` | | `.str-chat__channel-preview-data--loading` | `.str-chat__channel-list-item-data--loading` | ## Message/styling/Message.scss | Old Class Name | New Class Name | | ----------------------------------------- | ----------------------------------- | | `.str-chat__message-simple-name` | `.str-chat__message-metadata__name` | | `.str-chat__simple-message--error-failed` | `.str-chat__message-inner--error` | ## MessageComposer/styling/MessageComposer.scss | Old Class Name | New Class Name | | ----------------------------------- | -------------------------------------- | | `.str-chat__message-input-cooldown` | `.str-chat__message-composer-cooldown` | ## Additional TSX-only class names | Old Class Name | New Class Name | File(s) | | ----------------------------------------- | ---------------------------------------- | --------------------------------- | | `.str-chat__message-simple` | removed | MessageUI.tsx, MessageBlocked.tsx | | `.str-chat__message-simple--me` | removed | MessageUI.tsx, MessageBlocked.tsx | | `.str-chat__message-simple-name` | `.str-chat__message-metadata__name` | MessageUI.tsx | | `.str-chat__message-simple-timestamp` | `.str-chat__message-metadata__timestamp` | MessageUI.tsx | | `.str-chat__simple-message--error-failed` | `.str-chat__message-inner--error` | MessageUI.tsx | | `.str-chat__channel-preview--unread` | `.str-chat__channel-list-item--unread` | ChannelListItemUI.tsx | | `.str-chat__channel-preview--muted` | `.str-chat__channel-list-item--muted` | ChannelListItemUI.tsx | ## Removed class names (no replacement) | Removed Class Name | File | | ----------------------------------------------------- | ---------------------------------------- | | `.str-chat__message-simple__actions__action` | MessageActionsWrapper.tsx (file deleted) | | `.str-chat__message-simple__actions__action--options` | MessageActionsWrapper.tsx (file deleted) | BREAKING CHANGE: All `str-chat__channel-preview*` CSS classes have been renamed to `str-chat__channel-list-item*` (e.g. `.str-chat__channel-preview-container` β†’ `.str-chat__channel-list-item-container`); `.str-chat__message-input-cooldown` has been renamed to `.str-chat__message-composer-cooldown`; `.str-chat__message-simple-name` has been renamed to `.str-chat__message-metadata__name`; `.str-chat__simple-message--error-failed` has been renamed to `.str-chat__message-inner--error`; `.str-chat__message-simple-timestamp` has been renamed to `.str-chat__message-metadata__timestamp`. Removed `.str-chat__message-simple` and `.str-chat__message-simple--me` root class names from `MessageUI` and `MessageBlocked` components. Component `MessageActionsWrapper` has been dropped.
1 parent 7806658 commit 7c978a9

12 files changed

Lines changed: 52 additions & 82 deletions

File tree

β€Žsrc/components/ChannelListItem/ChannelListItemActionButtons.tsxβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const ChannelListItemActionButtons: ChannelListItemActionButtonsInterface
4444

4545
return (
4646
<div
47-
className={clsx('str-chat__channel-preview__action-buttons', {
48-
'str-chat__channel-preview__action-buttons--active': dialogIsOpen,
47+
className={clsx('str-chat__channel-list-item__action-buttons', {
48+
'str-chat__channel-list-item__action-buttons--active': dialogIsOpen,
4949
})}
5050
>
5151
{splitActionSet.dropdownActionSet.length > 0 && (
@@ -70,7 +70,7 @@ export const ChannelListItemActionButtons: ChannelListItemActionButtonsInterface
7070
<Component key={type} />
7171
))}
7272
<ContextMenu
73-
className='str-chat__channel-preview__action-buttons-context-menu'
73+
className='str-chat__channel-list-item__action-buttons-context-menu'
7474
dialogManagerId={dialogManager?.id}
7575
id={dialog.id}
7676
onClose={dialog?.close}

β€Žsrc/components/ChannelListItem/ChannelListItemTimestamp.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function ChannelListItemTimestamp({ lastMessage }: ChannelListItemTimesta
3030
if (!when) return null;
3131

3232
return (
33-
<time className='str-chat__channel-preview-timestamp' dateTime={normalizedTimestamp}>
33+
<time className='str-chat__channel-list-item-timestamp' dateTime={normalizedTimestamp}>
3434
{when}
3535
</time>
3636
);

β€Žsrc/components/ChannelListItem/ChannelListItemUI.tsxβ€Ž

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ const UnMemoizedChannelListItemUI = (props: ChannelListItemUIProps) => {
4949
};
5050

5151
return (
52-
<div className='str-chat__channel-preview-container'>
52+
<div className='str-chat__channel-list-item-container'>
5353
<ChannelListItemActionButtons />
5454
<button
5555
aria-label={`Select Channel: ${displayTitle || ''}`}
5656
aria-pressed={active}
5757
className={clsx(
58-
'str-chat__channel-preview',
59-
typeof unread === 'number' && unread > 0 && 'str-chat__channel-preview--unread',
60-
muted && 'str-chat__channel-preview--muted',
58+
'str-chat__channel-list-item',
59+
typeof unread === 'number' && unread > 0 && 'str-chat__channel-list-item--unread',
60+
muted && 'str-chat__channel-list-item--muted',
6161
customClassName,
6262
)}
63-
data-testid='channel-preview-button'
63+
data-testid='channel-list-item-button'
6464
onClick={onSelectChannel}
6565
ref={channelPreviewButton}
6666
role='option'
@@ -72,13 +72,13 @@ const UnMemoizedChannelListItemUI = (props: ChannelListItemUIProps) => {
7272
size='xl'
7373
userName={avatarName}
7474
/>
75-
<div className='str-chat__channel-preview-data'>
76-
<div className='str-chat__channel-preview-data__first-row'>
77-
<div className='str-chat__channel-preview-data__title'>
75+
<div className='str-chat__channel-list-item-data'>
76+
<div className='str-chat__channel-list-item-data__first-row'>
77+
<div className='str-chat__channel-list-item-data__title'>
7878
<span>{displayTitle || 'N/A'}</span>
7979
{muted && <IconMute />}
8080
</div>
81-
<div className='str-chat__channel-preview-data__timestamp-and-badge'>
81+
<div className='str-chat__channel-list-item-data__timestamp-and-badge'>
8282
<ChannelListItemTimestamp lastMessage={lastMessage} />
8383
{typeof unread === 'number' && unread > 0 && (
8484
<Badge data-testid='unread-badge' size='md' variant='primary'>

β€Žsrc/components/ChannelListItem/styling/ChannelListItem.scssβ€Ž

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
.str-chat__channel-preview-container {
1+
.str-chat__channel-list-item-container {
22
// display: flex;
33
padding: var(--spacing-xxs);
44
position: relative;
55

6-
&:has(.str-chat__channel-preview__action-buttons--active),
6+
&:has(.str-chat__channel-list-item__action-buttons--active),
77
&:hover {
8-
.str-chat__channel-preview__action-buttons {
8+
.str-chat__channel-list-item__action-buttons {
99
display: flex;
1010
}
1111
}
1212

13-
.str-chat__channel-preview__action-buttons {
13+
.str-chat__channel-list-item__action-buttons {
1414
display: none;
1515
position: absolute;
1616
gap: var(--spacing-xs);
@@ -36,11 +36,11 @@
3636
border-bottom: 1px solid var(--border-core-subtle);
3737
}
3838

39-
.str-chat__channel-preview__action-buttons-context-menu {
39+
.str-chat__channel-list-item__action-buttons-context-menu {
4040
min-width: 150px;
4141
}
4242

43-
.str-chat__channel-preview {
43+
.str-chat__channel-list-item {
4444
display: flex;
4545
gap: var(--spacing-md);
4646
align-items: center;
@@ -68,21 +68,21 @@
6868
flex-shrink: 0;
6969
}
7070

71-
.str-chat__channel-preview-data {
71+
.str-chat__channel-list-item-data {
7272
display: flex;
7373
flex-direction: column;
7474
gap: var(--spacing-xxs);
7575
flex-shrink: 1;
7676
flex-grow: 1;
7777
min-width: 0;
7878

79-
.str-chat__channel-preview-data__first-row {
79+
.str-chat__channel-list-item-data__first-row {
8080
display: flex;
8181
justify-content: space-between;
8282
align-items: center;
8383
gap: var(--spacing-md);
8484

85-
.str-chat__channel-preview-data__title {
85+
.str-chat__channel-list-item-data__title {
8686
flex-shrink: 1;
8787
flex-grow: 1;
8888
min-width: 0;
@@ -108,13 +108,13 @@
108108
}
109109
}
110110

111-
.str-chat__channel-preview-data__timestamp-and-badge {
111+
.str-chat__channel-list-item-data__timestamp-and-badge {
112112
flex-shrink: 0;
113113
display: flex;
114114
align-items: inherit;
115115
gap: var(--spacing-xs);
116116

117-
.str-chat__channel-preview-timestamp {
117+
.str-chat__channel-list-item-timestamp {
118118
font-weight: var(--typography-font-weight-regular);
119119
font-size: var(--typography-font-size-sm);
120120
color: var(--text-tertiary);

β€Žsrc/components/Loading/LoadingChannels.tsxβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react';
22

33
const LoadingItems = () => (
4-
<div className='str-chat__channel-preview-container'>
4+
<div className='str-chat__channel-list-item-container'>
55
<div
66
aria-hidden='true'
7-
className='str-chat__channel-preview str-chat__channel-preview--loading'
7+
className='str-chat__channel-list-item str-chat__channel-list-item--loading'
88
>
99
<div className='str-chat__loading-channels-avatar' />
10-
<div className='str-chat__channel-preview-data str-chat__channel-preview-data--loading'>
10+
<div className='str-chat__channel-list-item-data str-chat__channel-list-item-data--loading'>
1111
<div className='str-chat__loading-channels-username' />
1212
<div className='str-chat__loading-channels-status' />
1313
</div>

β€Žsrc/components/Loading/styling/LoadingChannels.scssβ€Ž

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@mixin channel-preview-shimmer {
2-
background-color: var(--str-chat__channel-preview-loading-state-color);
1+
@mixin channel-list-item-shimmer {
2+
background-color: var(--str-chat__channel-list-item-loading-state-color);
33
background-image: linear-gradient(
44
90deg,
55
var(--skeleton-loading-base) 0%,
@@ -13,32 +13,32 @@
1313

1414
.str-chat {
1515
/* The base surface color behind the channel list loading shimmer */
16-
--str-chat__channel-preview-loading-state-color: var(--background-core-surface);
16+
--str-chat__channel-list-item-loading-state-color: var(--background-core-surface);
1717
}
1818

1919
.str-chat__loading-channels {
2020
display: flex;
2121
flex-direction: column;
2222
}
2323

24-
.str-chat__channel-preview--loading {
24+
.str-chat__channel-list-item--loading {
2525
cursor: default;
2626
pointer-events: none;
2727
}
2828

29-
.str-chat__channel-preview--loading,
30-
.str-chat__channel-preview-data--loading {
29+
.str-chat__channel-list-item--loading,
30+
.str-chat__channel-list-item-data--loading {
3131
min-width: 0;
3232
}
3333

34-
.str-chat__channel-preview-data--loading {
34+
.str-chat__channel-list-item-data--loading {
3535
justify-content: center;
3636
}
3737

3838
.str-chat__loading-channels-avatar,
3939
.str-chat__loading-channels-username,
4040
.str-chat__loading-channels-status {
41-
@include channel-preview-shimmer;
41+
@include channel-list-item-shimmer;
4242
}
4343

4444
.str-chat__loading-channels-avatar {

β€Žsrc/components/Message/MessageBlocked.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const MessageBlocked = () => {
1212
const { isMyMessage } = useUserRole(message);
1313

1414
const messageClasses = clsx(
15-
'str-chat__message str-chat__message-simple str-chat__message--blocked',
15+
'str-chat__message str-chat__message--blocked',
1616
message.type,
1717
{
18-
'str-chat__message--me str-chat__message-simple--me': isMyMessage,
18+
'str-chat__message--me': isMyMessage,
1919
'str-chat__message--other': !isMyMessage,
2020
},
2121
);

β€Žsrc/components/Message/MessageUI.tsxβ€Ž

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,22 @@ const MessageUIWithContext = ({
136136
const showReplyCountButton = !threadList && !!message.reply_count;
137137

138138
const rootClassName = clsx(
139-
'str-chat__message str-chat__message-simple',
139+
'str-chat__message',
140140
`str-chat__message--${message.type}`,
141141
`str-chat__message--${message.status}`,
142-
isMyMessage()
143-
? 'str-chat__message--me str-chat__message-simple--me'
144-
: 'str-chat__message--other',
145-
message.text ? 'str-chat__message--has-text' : 'str-chat__message--has-no-text',
146-
textHasEmojisOnly
147-
? `str-chat__message--is-emoji-only-count-${countEmojis(message.text)}`
148-
: '',
149142
{
150143
'str-chat__message--has-attachment': hasAttachment,
151144
'str-chat__message--has-giphy-attachment': hasGiphyAttachment,
145+
'str-chat__message--has-no-text': !message.text,
146+
'str-chat__message--has-text': !!message.text,
147+
// eslint-disable-next-line sort-keys
152148
'str-chat__message--has-single-attachment': hasSingleAttachment,
153149
'str-chat__message--highlighted': highlighted,
154150
'str-chat__message--is-emoji-only': textHasEmojisOnly,
151+
[`str-chat__message--is-emoji-only-count-${countEmojis(message.text)}`]:
152+
textHasEmojisOnly,
153+
'str-chat__message--me': isMyMessage(),
154+
'str-chat__message--other': !isMyMessage(),
155155
'str-chat__message--pinned': message.pinned,
156156
'str-chat__message--with-avatar': (() => {
157157
if (!message.user) return false;
@@ -201,7 +201,7 @@ const MessageUIWithContext = ({
201201
)}
202202
<div
203203
className={clsx('str-chat__message-inner', {
204-
'str-chat__simple-message--error-failed': allowRetry || isBounced,
204+
'str-chat__message-inner--error': allowRetry || isBounced,
205205
})}
206206
data-testid='message-inner'
207207
onClick={handleClick}
@@ -245,11 +245,11 @@ const MessageUIWithContext = ({
245245
<div className='str-chat__message-metadata'>
246246
<MessageStatus />
247247
{!isMyMessage() && !!message.user && memberCount > 2 && (
248-
<span className='str-chat__message-simple-name'>
248+
<span className='str-chat__message-metadata__name'>
249249
{message.user.name || message.user.id}
250250
</span>
251251
)}
252-
<MessageTimestamp customClass='str-chat__message-simple-timestamp' />
252+
<MessageTimestamp customClass='str-chat__message-metadata__timestamp' />
253253
{!isDeleted && isEdited && <MessageEditedIndicator />}
254254
</div>
255255
)}

β€Žsrc/components/Message/styling/Message.scssβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@
510510
font: var(--str-chat__metadata-default-text);
511511
}
512512

513-
.str-chat__message-simple-name {
513+
.str-chat__message-metadata__name {
514514
@include utils.prevent-glitch-text-overflow;
515515
margin-inline-end: var(--spacing-xxs);
516516
}
@@ -559,7 +559,7 @@
559559
}
560560
}
561561

562-
.str-chat__simple-message--error-failed {
562+
.str-chat__message-inner--error {
563563
cursor: pointer;
564564
}
565565

β€Žsrc/components/MessageActions/MessageActionsWrapper.tsxβ€Ž

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
Β (0)