Skip to content

Commit 32c8fc0

Browse files
authored
feat!: remove fullWidth prop from Thread & hideOnThread prop from Window (#2450)
BREAKING CHANGE: removed Thread prop fullWidth, removed class str-chat__thread--full BREAKING CHANGE: removed Window prop hideOnThread, replaced class str-chat__main-panel--hideOnThread with str-chat__main-panel--thread-open
1 parent b1a4842 commit 32c8fc0

File tree

16 files changed

+185
-189
lines changed

16 files changed

+185
-189
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ For components that implement significant logic, it's helpful to split the compo
9090

9191
### Customizing Styles
9292

93-
The preferred method for overriding the pre-defined styles in the library is to two step process. First, import our bundled CSS into the file where you instantiate your chat application. Second, locate any Stream styles you want to override using either the browser inspector or by viewing the library code. You can then add selectors to your local CSS file to override our defaults. For example:
93+
The preferred method for overriding the pre-defined styles in the library is to two-step process. First, import our bundled CSS into the file where you instantiate your chat application. Second, locate any Stream styles you want to override using either the browser inspector or by viewing the library code. You can then add selectors to your local CSS file to override our defaults. For example:
9494

9595
```js
9696
import 'stream-chat-react/dist/css/v2/index.css';

docusaurus/docs/React/basics/getting-started.mdx

+35-8
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,37 @@ body,
7676
display: flex;
7777
height: 100%;
7878

79-
.str-chat-channel-list {
79+
.str-chat__channel-list {
8080
position: fixed;
8181
z-index: 1;
82+
height: 100%;
8283
width: 0;
84+
flex-shrink: 0;
85+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
8386

8487
&--open {
85-
width: 100%;
88+
width: 30%;
89+
position: fixed;
8690
}
91+
transition: width 0.3s ease-out;
92+
}
93+
94+
.str-chat__channel {
95+
flex: 1;
96+
min-width: 0;
8797
}
8898

89-
.str-chat-channel {
90-
width: 100%;
99+
.str-chat__main-panel {
100+
min-width: 0;
101+
flex: 1;
102+
103+
&--thread-open {
104+
display: none;
105+
}
91106
}
92107

93108
.str-chat__thread {
94-
width: 100%;
109+
flex: 1;
95110
height: 100%;
96111
position: fixed;
97112
z-index: 1;
@@ -117,9 +132,8 @@ body,
117132
}
118133

119134
@media screen and (min-width: 768px) {
120-
.str-chat-channel-list {
135+
.str-chat__channel-list {
121136
width: 30%;
122-
max-width: 420px;
123137
position: initial;
124138
z-index: 0;
125139
}
@@ -128,11 +142,24 @@ body,
128142
position: initial;
129143
z-index: 0;
130144
}
145+
146+
.str-chat__channel-header .str-chat__header-hamburger {
147+
display: none;
148+
}
131149
}
132150

133151
@media screen and (min-width: 1024px) {
152+
.str-chat__main-panel {
153+
min-width: 0;
154+
155+
&--thread-open {
156+
max-width: 55%;
157+
display: flex;
158+
}
159+
}
160+
134161
.str-chat__thread {
135-
width: 45%;
162+
max-width: 45%;
136163
}
137164

138165
.str-chat__channel-header .str-chat__header-hamburger {

docusaurus/docs/React/components/core-components/thread.mdx

-8
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,6 @@ Controls injection of <GHComponentLink text='DateSeparator' path='/DateSeparator
169169
| ------- | ------- |
170170
| boolean | false |
171171

172-
### fullWidth
173-
174-
If true, displays the thread at 100% width of its parent container, useful for mobile styling.
175-
176-
| Type | Default |
177-
| ------- | ------- |
178-
| boolean | false |
179-
180172
### Input
181173

182174
Custom UI component to replace the `MessageInput` of a `Thread`. The component uses `MessageInputFlat` by default.

docusaurus/docs/React/components/utility-components/window.mdx

-8
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ This ensures correct width changes in the main channel when opening and closing
2424

2525
## Props
2626

27-
### hideOnThread
28-
29-
The boolean to show or hide the `Window` when a `Thread` is active.
30-
31-
| Type | Default |
32-
| ------- | ------- |
33-
| boolean | false |
34-
3527
### thread
3628

3729
An optional prop to manually trigger the opening of a thread.

docusaurus/docs/React/release-guides/upgrade-to-v12.mdx

+33-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,37 @@ The `Avatar` styles are applied through CSS from the version 12 upwards. Therefo
151151
3\. If needed, apply custom styles to newly added classes based on the component that renders the `Avatar`.
152152
:::
153153

154+
## Removal of styling props
155+
156+
### Removal of Window's hideOnThread prop
157+
158+
The prop boolean `hideOnThread` enabled us to control, whether class `str-chat__main-panel--hideOnThread` was attached to `Window` component's root `<div/>`. By assigning this class a CSS rule `display: none` in the default SDK's stylesheet we hid the contents of `Window`. We decided to simplify the logic in this case:
159+
160+
1. class `str-chat__main-panel--hideOnThread` was replaced by class `str-chat__main-panel--thread-open`
161+
2. the class `str-chat__main-panel--thread-open` is attached to the root `<div/>` always, when thread is open
162+
3. the default value of `hideOnThread` prop was `false` (`Window` contents was not hidden upon opening a thread) and so integrators still have to opt in to hiding the contents upon opening a thread by adding rule `display: none` to `str-chat__main-panel--thread-open` class
163+
164+
:::important
165+
**Action required**
166+
If your application renders `Window` with `hideOnThread` enabled, and you want to keep this behavior add the following rule to your CSS:
167+
168+
```css
169+
.str-chat__main-panel--thread-open {
170+
display: none;
171+
}
172+
173+
.str-chat__main-panel--thread-open + .str-chat__thread {
174+
// occupy the whole space previously occupied by the main message list container
175+
flex: 1;
176+
}
177+
```
178+
179+
:::
180+
181+
### Removal of Thread's fullWidth prop
182+
183+
Setting the `fullWidth` value to `true` let to assignment of class `str-chat__thread--full` to the `Thread` component's root `<div/>`. This class had support in the SDK's legacy stylesheet only. With the approach of avoiding styling React components via props, the prop has been removed along with the legacy stylesheet. Read more about the the stylesheet removal in the [section **Removal of deprecated components**](#removal-of-deprecated-components).
184+
154185
## Removal of deprecated components
155186

156187
### Attachment rendering utility functions
@@ -330,12 +361,13 @@ Replace the removed classes with their alternatives in the custom CSS.
330361
| `QuotedMessagePreview` root `<div/>` | `quoted-message-preview` | no alternative |
331362
| `QuotedMessagePreview` | `quoted-message-preview-content` | `str-chat__quoted-message-preview` |
332363
| `QuotedMessagePreview` | `quoted-message-preview-content-inner` | `str-chat__quoted-message-bubble` |
333-
| `MessageList` | `str-chat__list--thread` | `str-chat__thread-list` |
364+
| `MessageList` | `str-chat__thread--full` | no alternative |
334365
| `InfiniteScroll` rendered by `MessageList` | `str-chat__reverse-infinite-scroll` | `str-chat__message-list-scroll` |
335366
| `ScrollToBottomButton` | `str-chat__message-notification-right` | `str-chat__message-notification-scroll-to-latest` |
336367
| `ScrollToBottomButton` | `str-chat__message-notification-scroll-to-latest-unread-count` | `str-chat__jump-to-latest-unread-count` |
337368
| `ReactionsListModal` | `emoji` | `str-chat__message-reaction-emoji` or `str-chat__message-reaction-emoji--with-fallback` |
338369
| `SimpleReactionList` | `str-chat__simple-reactions-list-tooltip` | no alternative - markup removal |
370+
| `Thread` | `str-chat__list--thread` | `str-chat__thread-list` |
339371
| `ThreadHeader` | `str-chat__square-button` | `str-chat__close-thread-button` |
340372
| `TypingIndicator` | `str-chat__typing-indicator__avatars` | no alternative - markup removal |
341373

examples/typescript/src/App.css

-18
This file was deleted.

examples/typescript/src/App.test.tsx

-9
This file was deleted.

examples/typescript/src/App.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import React from 'react';
2-
import { ChannelFilters, ChannelOptions, ChannelSort, StreamChat, UR } from 'stream-chat';
2+
import { ChannelFilters, ChannelOptions, ChannelSort, StreamChat } from 'stream-chat';
33
import {
4-
Chat,
54
Channel,
65
ChannelHeader,
76
ChannelList,
8-
VirtualizedMessageList as MessageList,
7+
Chat,
98
MessageInput,
109
Thread,
10+
VirtualizedMessageList as MessageList,
1111
Window,
1212
} from 'stream-chat-react';
1313

14-
import './App.css';
15-
1614
const params = (new Proxy(new URLSearchParams(window.location.search), {
1715
get: (searchParams, property) => searchParams.get(property as string),
1816
}) as unknown) as Record<string, string | null>;

examples/typescript/src/index.scss

+49-38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
body {
2-
margin: 0;
32
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
43
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
54
-webkit-font-smoothing: antialiased;
@@ -11,74 +10,84 @@ code {
1110
}
1211

1312

13+
body {
14+
margin: 0;
15+
-webkit-font-smoothing: antialiased;
16+
-moz-osx-font-smoothing: grayscale;
17+
}
18+
19+
html,
20+
body,
21+
#root {
22+
margin: unset;
23+
padding: unset;
24+
height: 100%;
25+
}
26+
27+
1428
#root {
1529
display: flex;
1630
height: 100%;
1731

18-
.str-chat-channel-list {
32+
.str-chat__channel-list {
1933
position: fixed;
2034
z-index: 1;
35+
height: 100%;
2136
width: 0;
37+
flex-shrink: 0;
38+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);;
2239

2340
&--open {
24-
width: 100%;
41+
width: 30%;
42+
position: fixed;
2543
}
44+
transition: width 0.3s ease-out;
2645
}
2746

2847
.str-chat__channel {
29-
width: 100%;
48+
flex: 1;
49+
min-width: 0;
50+
}
51+
52+
.str-chat__main-panel {
53+
min-width: 0;
54+
flex: 1;
55+
56+
&--thread-open {
57+
display: none;
58+
}
3059
}
3160

3261
.str-chat__thread {
33-
width: 100%;
62+
flex: 1;
3463
height: 100%;
3564
position: fixed;
3665
z-index: 1;
3766
}
3867

3968
.str-chat__channel-header .str-chat__header-hamburger {
4069
width: 30px;
41-
height: 30px;
70+
height: 38px;
71+
padding: var(--xxs-p);
72+
margin-right: var(--xs-m);
4273
display: flex;
4374
align-items: center;
4475
justify-content: center;
4576
cursor: pointer;
4677
border: none;
4778
background: transparent;
4879

49-
svg {
50-
width: 25px;
51-
height: 25px;
52-
}
53-
5480
&:hover {
5581
svg path {
5682
fill: var(--primary-color);
5783
}
5884
}
5985
}
6086

87+
6188
@media screen and (min-width: 768px) {
62-
//.str-chat-channel-list.thread-open {
63-
// &.menu-open {
64-
// width: 30%;
65-
// height: 100%;
66-
// position: fixed;
67-
// z-index: 1;
68-
// }
69-
//
70-
// &.menu-close {
71-
// width: 0;
72-
// }
73-
//
74-
// & + .channel .menu-button {
75-
// display: block;
76-
// }
77-
//}
78-
79-
.str-chat-channel-list {
89+
.str-chat__channel-list {
8090
width: 30%;
81-
max-width: 420px;
8291
position: initial;
8392
z-index: 0;
8493
}
@@ -94,20 +103,22 @@ code {
94103
}
95104

96105
@media screen and (min-width: 1024px) {
97-
//.str-chat-channel-list {
98-
// max-width: 420px;
99-
// position: initial;
100-
// z-index: 0;
101-
//}
106+
.str-chat__main-panel {
107+
min-width: 0;
108+
109+
&--thread-open {
110+
max-width: 55%;
111+
display: flex;
112+
}
113+
}
102114

103115
.str-chat__thread {
104-
width: 45%;
105-
//position: initial;
106-
//z-index: 0;
116+
max-width: 45%;
107117
}
108118

109119
.str-chat__channel-header .str-chat__header-hamburger {
110120
display: none;
111121
}
112122
}
113123
}
124+

0 commit comments

Comments
 (0)