Commit c89366b
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
0 commit comments