Skip to content

Commit 1a5539b

Browse files
committed
(demo) add theme buttons
1 parent b74a31e commit 1a5539b

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

demo/src/App.vue

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@
1111
{{ user.username }}
1212
</option>
1313
</select>
14-
<chat-container :currentUserId="currentUserId" v-if="showChat" />
14+
15+
<div class="button-theme">
16+
<button @click="theme = 'light'" class="button-light">Light</button>
17+
<button @click="theme = 'dark'" class="button-dark">Dark</button>
18+
</div>
19+
20+
<chat-container
21+
:currentUserId="currentUserId"
22+
:theme="theme"
23+
v-if="showChat"
24+
/>
1525
</div>
1626
</div>
1727
</template>
@@ -27,6 +37,7 @@ export default {
2737
2838
data() {
2939
return {
40+
theme: 'light',
3041
showChat: true,
3142
users: [
3243
{
@@ -124,4 +135,37 @@ select {
124135
font-size: 12px;
125136
margin-right: 5px;
126137
}
138+
139+
.button-theme {
140+
float: right;
141+
142+
.button-light {
143+
background: #cbced1;
144+
}
145+
146+
.button-dark {
147+
background: #1C1D21;
148+
}
149+
150+
button {
151+
color: #fff;
152+
outline: none;
153+
cursor: pointer;
154+
border-radius: 4px;
155+
padding: 8px 12px;
156+
margin-left: 10px;
157+
border: none;
158+
font-size: 14px;
159+
transition: 0.3s;
160+
vertical-align: middle;
161+
162+
&:hover {
163+
opacity: 0.8;
164+
}
165+
166+
&:active {
167+
opacity: 0.6;
168+
}
169+
}
170+
}
127171
</style>

demo/src/ChatContainer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
<chat-window
4949
height="calc(100vh - 80px)"
50+
:theme="theme"
5051
:rooms="rooms"
5152
:loadingRooms="loadingRooms"
5253
:messages="messages"
@@ -81,7 +82,7 @@ export default {
8182
ChatWindow
8283
},
8384
84-
props: ['currentUserId'],
85+
props: ['currentUserId', 'theme'],
8586
8687
data() {
8788
return {

0 commit comments

Comments
 (0)