Skip to content

Commit c89366b

Browse files
authored
fix(ChannelList): make channel list and thread list width app-driven (#3235)
### 🎯 Goal The SDK shouldn't hold strict opinions about how wide the channel list (and thread list) sidebars are β€” that's a layout decision the parent app owns. Previously `--str-chat__channel-list-width` defaulted to `30%`, effectively dictating a desktop two-pane ratio out of the box. This makes the sidebar width app-driven: the SDK defaults to filling available space, and the app constrains it via the CSS variable (as the vite example already does with its own layout token). ### πŸ›  Implementation details - **`ChannelList.scss`** β€” change the default `--str-chat__channel-list-width` from `30%` β†’ `100%`. The channel list is `flex: 0 0 var(--str-chat__channel-list-width)`, so apps drive the width by overriding the variable (not the `width` property, since a non-`auto` `flex-basis` wins in a flex row). - **`ThreadList.scss`** β€” decouple `--str-chat__thread-list-width` and `--str-chat__thread-list-mobile-width` from the channel-list tokens. They previously resolved to `var(--str-chat__channel-list-width)` / `var(--str-chat__channel-list-mobile-width)`, which meant sizing the channel list silently resized the thread list too. They now have their own independent `100%` defaults, so each sidebar is sized independently. - Transition tokens (`duration`/`easing`/`offset`) remain shared β€” those are animation consistency, not width, and are unchanged. **Notes / compatibility** - Behavioral default change: an app relying on the old built-in `30%` desktop sidebar will now see a full-width channel list until it sets `--str-chat__channel-list-width` itself. - Mobile is unaffected β€” the mobile breakpoint already forces a `100%` absolutely-positioned overlay with `min-width: 0`. - Examples that already override the variable (`examples/vite`, tutorial shell) are unaffected. `yarn build-styling` compiles cleanly. ### 🎨 UI Changes No screenshots attached β€” this is a CSS custom-property default change with no markup changes. Visible effect: without an app-provided width override, the desktop channel list renders full-width (fills its flex container) instead of the previous `30%` sidebar. Apps set `--str-chat__channel-list-width` (and now optionally `--str-chat__thread-list-width` independently) to restore a fixed/percentage sidebar.
1 parent 2c08f53 commit c89366b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
--str-chat__channel-list-transition-offset: 8px;
1212

1313
/* Default desktop width of the channel list. Override to match custom layouts. */
14-
--str-chat__channel-list-width: 30%;
14+
--str-chat__channel-list-width: 100%;
1515

1616
/* Default mobile overlay width of the channel list. Override to match custom layouts. */
1717
--str-chat__channel-list-mobile-width: 100%;

β€Žsrc/components/Threads/ThreadList/styling/ThreadList.scssβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
--str-chat__thread-list-transition-offset: var(
1111
--str-chat__channel-list-transition-offset
1212
);
13-
--str-chat__thread-list-width: var(--str-chat__channel-list-width);
14-
--str-chat__thread-list-mobile-width: var(--str-chat__channel-list-mobile-width);
13+
/* Default desktop width of the thread list. Override to match custom layouts. */
14+
--str-chat__thread-list-width: 100%;
15+
16+
/* Default mobile overlay width of the thread list. Override to match custom layouts. */
17+
--str-chat__thread-list-mobile-width: 100%;
1518
}
1619

1720
.str-chat__thread-list-container {

0 commit comments

Comments
Β (0)