Skip to content

Commit aa9cbb1

Browse files
committed
docs: Add tutorial #73
feat: Update stream-chat, make stream-chat-css a peer dependency docs: Add tutorial docs: Expand theming docs docs: Add missing channel header docs
1 parent a6acf1e commit aa9cbb1

File tree

8 files changed

+448
-12
lines changed

8 files changed

+448
-12
lines changed
1.95 MB
Loading
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
id: channel-header
3+
sidebar_position: 12
4+
title: Channel header
5+
---
6+
7+
import ChannelHeaderScreenshot from "../assets/channel-header-screenshot.png";
8+
9+
The `ChannelHeader` component displays the avatar and name of the currently active channel along with member and watcher information. You can read about the difference between members and watchers [here](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript#watchers-vs-members).
10+
11+
**Example 1** - Channel header:
12+
13+
<img src={ChannelHeaderScreenshot} width="500" />
14+
15+
## Customization
16+
17+
If you want to, you can create your own custom channel header, here is how to use it:
18+
19+
```html
20+
<stream-channel-list></stream-channel-list>
21+
<stream-channel>
22+
<custom-channel-header></custom-channel-header>
23+
<stream-message-list></stream-message-list>
24+
<stream-notification-list></stream-notification-list>
25+
<stream-message-input></stream-message-input>
26+
</stream-channel>
27+
```
28+
29+
If you create your own channel header, you can use the [`ChannelService`](../services/channel.mdx) to access the currently active channel. Please note that, the default channel header also contains the menu button to [toggle the channel list](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/channel-list/channel-list-toggle.service.ts). Here is a simple implementation of a custom channel header to guide you:
30+
31+
```typescript
32+
@Component({
33+
selector: "custom-channel-header",
34+
template: `
35+
<button (click)="toggleMenu()">Menu</button>
36+
{{ activeChannel?.data?.name }}
37+
`,
38+
styles: [],
39+
})
40+
export class ChannelHeaderComponent {
41+
activeChannel: Channel | undefined;
42+
43+
constructor(
44+
private channelService: ChannelService,
45+
private channelListToggleService: ChannelListToggleService
46+
) {
47+
this.channelService.activeChannel$.subscribe(
48+
(c) => (this.activeChannel = c)
49+
);
50+
}
51+
52+
toggleMenu() {
53+
this.channelListToggleService.toggle();
54+
}
55+
}
56+
```

docusaurus/docs/Angular/concepts/themeing.mdx renamed to docusaurus/docs/Angular/concepts/themeing-and-css.mdx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: themeing
33
sidebar_position: 1
4-
title: Themeing
4+
title: Themeing and CSS
55
---
66

77
import LightThemeScreenshot from "../assets/light-theme-screenshot.png";
@@ -55,3 +55,37 @@ The result:
5555
**Example 2** - Custom dark theme
5656

5757
<img src={CustomDarkThemeScreenshot} width="900" />
58+
59+
## Overriding CSS
60+
61+
To override pre-defined library styles, follow this simple process:
62+
63+
- Import our bundled CSS into your root stylesheet. We maintain a separate repository, [stream-chat-css](https://github.com/GetStream/stream-chat-css), which houses all of the SCSS files for the components.
64+
65+
- Use the browser inspector or view the library code and locate default styles you wish to override
66+
67+
- Add selectors to your local CSS file to override our defaults.
68+
69+
- Add your local CSS selectors after Stream's bundled CSS
70+
71+
For example:
72+
73+
```scss
74+
import 'stream-chat-css/dist/css/index.css';
75+
76+
/* Your CSS here */
77+
```
78+
79+
## Importing scss Files
80+
81+
As an alternative to importing our entire style sheet (perhaps, due to it's size), there's also the option to easily assemble only
82+
what you need by importing individual scss files. The imports should happen in your root stylesheet.
83+
84+
Here's a complete [list of scss files](https://unpkg.com/browse/[email protected]/dist/scss/) broken down by size and with the
85+
option of filtering by version.
86+
87+
:::note
88+
If not importing our entire bundled CSS, individually importing the SDK's scss files is the better alternative to copy and pasting
89+
our stylesheets and then customizing that code in your application. The CSS in the library does change occasionally, and you want
90+
to keep up to date with these to ensure no problems arise by falling behind in important styling updates.
91+
:::

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"dotenv": "^10.0.0",
6565
"pretty-bytes": "^5.6.0",
6666
"rxjs": "~6.6.0",
67-
"stream-chat": "^4.1.0",
67+
"stream-chat": "^4.3.0",
6868
"stream-chat-css": "1.0.18",
6969
"ts-node": "^10.2.1",
7070
"tslib": "^2.3.0",

projects/stream-chat-angular/ng-package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"entryFile": "src/public-api.ts"
77
},
88
"allowedNonPeerDependencies": [
9-
"stream-chat-css",
109
"dayjs",
1110
"@ctrl/ngx-emoji-mart",
1211
"uuidv4",

projects/stream-chat-angular/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"@angular/common": "^12.2.0",
66
"@angular/core": "^12.2.0",
77
"@ngx-translate/core": "^13.0.0",
8-
"stream-chat": "^4.1.0"
8+
"stream-chat": "^4.3.0",
9+
"stream-chat-css": "1.0.18"
910
},
1011
"dependencies": {
1112
"@ctrl/ngx-emoji-mart": "^6.0.1",
1213
"dayjs": "^1.10.7",
1314
"pretty-bytes": "^5.6.0",
14-
"stream-chat-css": "1.0.18",
1515
"tslib": "^2.3.0",
1616
"uuidv4": "^6.2.12"
1717
}

0 commit comments

Comments
 (0)