Skip to content

Commit fd2fcae

Browse files
committed
(props) add singleRoom prop
1 parent 6848a4e commit fd2fcae

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ You can import it as a custom component:
9696
| showReactionEmojis | Boolean | - | true |
9797
| textMessages (6) | Object | - | null |
9898
| responsiveBreakpoint (7) | Number | - | 900 |
99-
| theme (8) | Sring | - | light |
100-
| styles (9) | Object | - | (9) |
99+
| singleRoom (8) | Number | - | 900 |
100+
| theme (9) | Sring | - | light |
101+
| styles (10) | Object | - | (10) |
101102

102103
(1) `currentUserId` is required to display UI and trigger actions according to the user using the chat (ex: messages position on the right, etc.)
103104

@@ -178,11 +179,13 @@ textMessages="{
178179
}"
179180
```
180181

181-
(7) `responsiveBreakpoint` can be used to collapse the rooms list on the left when then viewport size goes below the specified width
182+
(7) `responsiveBreakpoint` can be used to collapse the rooms list on the left when then viewport size goes below the specified width.
182183

183-
(8) `theme` can be used to change the chat theme. Currently, only `light` and `dark` are available.
184+
(8) `singleRoom` can be used if you never want to show the rooms list on the left. You still need to pass the `rooms` prop as an array with a single element.
184185

185-
(9) `styles` can be used to customize your own theme. Ex:
186+
(9) `theme` can be used to change the chat theme. Currently, only `light` and `dark` are available.
187+
188+
(10) `styles` can be used to customize your own theme. Ex:
186189

187190
```javascript
188191
styles="{

src/ChatWindow/ChatWindow.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="card-window" :style="[{ height }, cssVars]">
33
<div class="chat-container">
44
<rooms-list
5+
v-if="!singleRoom"
56
:currentUserId="currentUserId"
67
:rooms="rooms"
78
:loadingRooms="loadingRooms"
@@ -26,6 +27,7 @@
2627
:showEmojis="showEmojis"
2728
:showReactionEmojis="showReactionEmojis"
2829
:textMessages="t"
30+
:singleRoom="singleRoom"
2931
:showRoomsList="showRoomsList"
3032
:isMobile="isMobile"
3133
:loadingRooms="loadingRooms"
@@ -64,6 +66,7 @@ export default {
6466
theme: { type: String, default: 'light' },
6567
styles: { type: Object, default: () => ({}) },
6668
responsiveBreakpoint: { type: Number, default: 900 },
69+
singleRoom: { type: Boolean, default: false },
6770
textMessages: { type: Object, default: null },
6871
currentUserId: { type: [String, Number], default: '' },
6972
rooms: { type: Array, default: () => [] },

src/ChatWindow/Room.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<template>
22
<div
33
class="col-messages"
4-
:class="{ 'col-messages-full': !showRoomsList }"
4+
:class="{ 'col-messages-full': !showRoomsList || singleRoom }"
55
v-show="(isMobile && !showRoomsList) || !isMobile"
66
>
77
<div class="room-header app-border-b">
88
<div
9+
v-if="!singleRoom"
910
class="svg-button toggle-button"
1011
:class="{ 'rotate-icon': !showRoomsList && !isMobile }"
1112
@click="$emit('toggleRoomsList')"
@@ -234,6 +235,7 @@ export default {
234235
props: {
235236
currentUserId: { type: [String, Number], required: true },
236237
textMessages: { type: Object, required: true },
238+
singleRoom: { type: Boolean, required: true },
237239
showRoomsList: { type: Boolean, required: true },
238240
isMobile: { type: Boolean, required: true },
239241
rooms: { type: Array, required: true },

0 commit comments

Comments
 (0)