커스터마이징
컴포넌트 재정의
VChatCloudApp
컴포넌트 대신 VChatCloudProvider
컴포넌트를 사용하여 UI를 더욱 자유롭게 구성할 수 있습니다. VChatCloudProvider
내부에 원하는 React 컴포넌트를 배치하고, useVChatCloud
훅을 통해 VChatCloud 서비스와 관련된 필요한 데이터 및 함수에 접근할 수 있습니다.
WARNING
useVChatCloud
훅은 반드시 VChatCloudProvider
컴포넌트의 자손 컴포넌트 내에서만 호출해야 합니다.
tsx
import { VChatCloudProvider, useVChatCloud } from "@vchatcloud/react-ui-kit";
import { useCallback } from "react";
const SendButton: React.FC = () => {
const { channel } = useVChatCloud();
const handleSendMessage = useCallback(() => {
channel?.sendMessage({ message: "Hello VChatCloud!" });
}, [channel]);
return <button onClick={handleSendMessage}>전송</button>;
};
const App = () => {
return (
<VChatCloudProvider
clientKey={clientKey}
company={company}
email={email}
grade={grade}
logoUrl={logoUrl}
nickName={nickName}
privateContainer={privateContainer}
roomId={roomId}
sessionType={sessionType}
url={url}
userInfo={userInfo}
onDisconnect={onDisconnect}
>
{/* VChatCloudProvider 내부에서 SendButton 컴포넌트 사용 */}
<SendButton />
</VChatCloudProvider>
);
}
export default App;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
색상 변경
React UI Kit의 기본적인 스타일은 CSS 변수를 통해 정의되어 있어, 이를 덮어쓰는 방식으로 손쉽게 색상 테마를 변경할 수 있습니다.
사용 가능한 CSS 변수 목록
css
/* 일반, 라이트 모드 */
:root,
:root .light {
--button-primary: #0a0a6b;
--button-secondary: #fff;
--image-invert: none;
--scrollbar-bg: #cfcfcf;
--login-bg: #c9c9f2;
--login-desc: #0033ab;
--login-footer: #0a0a6b4c;
--profile-shadow: 1px 1.7px 7px 0 rgba(201, 201, 201, 0.3);
--profile-border: #f2f2f2;
--profile-bg: #fff;
--profile-button-bg: #aaa;
--profile-img-border: #eaeaea;
--profile-input-border: #dddddd;
--profile-input-color: #000;
--profile-input-focus-border: #0033ab;
--notify-toast-box-shadow: 1.5px 2.6px 5px 0 rgba(168, 168, 168, 0.3);
--notify-toast-bg-color: #363940;
--notify-toast-text-color: #fff;
--drawer-color-bg: #fff;
--drawer-color-text: #333;
--drawer-color-border: #ddd;
--drawer-color-shadow: rgba(168, 168, 168, 0.3);
--drawer-color-drawer-border: #f2f2f2;
--file-drawer-border-color: #ddd;
--file-drawer-header-title-color: #333;
--file-drawer-tab-color: #666;
--file-drawer-tab-focus-color: #000;
--file-drawer-tab-focus-border-color: #000;
--file-drawer-select-count-color: #666;
--file-drawer-save-color: #000;
--preview-item-checked-border-color: #4160b9;
--file-item-preview-bg: #fff;
--file-item-preview-border: #f2f2f2;
--file-item-preview-text: #000;
--file-item-preview-sub-text: #999;
--translate-modal-shadow: rgba(168, 168, 168, 0.3);
--translate-modal-popup-bg: #fff;
--translate-modal-border-color: #f2f2f2;
--translate-modal-title-color: #333;
--translate-modal-translate-bg-color: #ddd;
--translate-modal-translate-text-color: #000;
--modal-dim: rgba(0, 0, 0, 0.7);
--modal-shadow: rgba(168, 168, 168, 0.3);
--modal-bg: #fff;
--modal-border: #f2f2f2;
--modal-title: #333;
--modal-content: #444;
--invite-popup-input-bg: #fff;
--invite-popup-input-border: #ddd;
--invite-popup-input-color: #666;
--secret-bg-color: #ddd;
--secret-text-color: #000;
--checkbox-border-color: #ddd;
--checkbox-bg-color: #fff;
--user-item-border-color: #f2f2f2;
--user-item-nickname-color: #333;
--user-item-translate-color: #999;
--toggle-bar-color: #ddd;
--toggle-bar-on-color: #c9ddff;
--toggle-dot-color: #999;
--toggle-dot-on-color: #2a61be;
--toggle-label-color: #666;
--whisper-modal-input-text-color: #000;
--whisper-modal-input-bg-color: #fff;
--whisper-modal-input-border-color: #ddd;
--user-popup-shadow: rgba(168, 168, 168, 0.3);
--user-popup-border: #f2f2f2;
--user-popup-bg: #fff;
--user-popup-text: #000;
--user-popup-focus-bg: #0a0a6b;
--user-popup-focus-text: #fff;
--user-popup-opacity: 1;
--user-popup-focus-opacity: 1;
--user-popup-whisper-normal-img: url("/src/assets/images/ico-whisper-normal.webp");
--user-popup-notify-normal-img: url("/src/assets/images/ico-notify-normal.webp");
--user-popup-whisper-focus-img: url("/src/assets/images/ico-whisper-focus.webp");
--user-popup-notify-focus-img: url("/src/assets/images/ico-notify-focus.webp");
--chatting-field-bg: #fff;
--chatting-field-nickname: #0033ab;
--chatting-field-input-text: #000;
--chatting-field-input-placeholder: #888;
--chatting-field-border-color: #ddd;
--chatting-field-input-size-color: #999;
--emoticon-field-border-color: #ddd;
--emoticon-field-hover-bg-color: rgba(0, 0, 0, 0.1);
--emoticon-field-list-bg-color: #f2f2f2;
--emoticon-field-list-opacity: 1;
--emoticon-field-focus-border-color: #ddd;
--emoticon-field-focus-box-shadow: 1px 1.7px 1px 0 rgba(207, 207, 207, 0.3);
--emoticon-field-focus-bg-color: #fff;
--scroll-down-bg: #fff;
--scroll-down-text: #333;
--scroll-down-border: #ddd;
--scroll-down-shadow: rgba(105, 105, 105, 0.25);
--chatting-header-bg: #f2f2f2;
--chatting-header-border: #f2f2f2;
--chatting-header-text: #000;
--chatting-header-user-count: #999;
--chatting-body-bg: #fff;
--notice-item-bg: #333;
--notice-item-content: #fff;
--notice-item-shadow: rgba(157, 173, 184, 0.3);
--chat-base-border: #f2f2f2;
--chat-base-nickname: #666;
--chat-base-time: #999;
--text-chat-item-message: #333;
--whisper-item-from: #e1dffc;
--whisper-item-nickname-from: #0a0a6b;
--whisper-item-to: #f2f2f2;
--whisper-item-nickname-to: #0a0a6b;
--whisper-item-nickname-where: #666;
--whisper-item-message: #010000;
--whisper-item-time: #999;
--whisper-item-shadow: rgba(157, 173, 184, 0.3);
--join-item-message: #0033ab;
--exit-item-message: #ff5a5a;
--alert-item-message: #ff7800;
--open-graph-item-border: #ddd;
--open-graph-item-shadow: rgba(157, 173, 184, 0.3);
--open-graph-item-background: #fff;
--open-graph-item-title: #333;
--open-graph-item-desc: #666;
--radio-group-border: #ddd;
--radio-group-checked: #000;
--radio-group-radio-bg: #fff;
--radio-group-text: #000;
}
/* 다크 모드 */
:root .dark {
--button-primary: #fff;
--button-secondary: #000;
--image-invert: invert(100%);
--scrollbar-bg: #444;
--login-bg: #292929;
--login-desc: #ddd;
--login-footer: #aaa;
--profile-shadow: 1.5px 2.6px 5px 0 rgba(0, 0, 0, 0.3);
--profile-border: #444;
--profile-bg: #313131;
--profile-button-bg: #aaa;
--profile-img-border: #444;
--profile-input-border: #444;
--profile-input-color: #fff;
--profile-input-focus-border: #fff;
--notify-toast-box-shadow: 1.5px 2.6px 5px 0 rgba(0, 0, 0, 0.3);
--notify-toast-bg-color: #333;
--notify-toast-text-color: #fff;
--drawer-color-bg: #333;
--drawer-color-text: #fff;
--drawer-color-border: #444;
--drawer-color-shadow: rgba(0, 0, 0, 0.3);
--drawer-color-drawer-border: #444;
--file-drawer-border-color: #444;
--file-drawer-header-title-color: #fff;
--file-drawer-tab-color: #ddd;
--file-drawer-tab-focus-color: #fff;
--file-drawer-tab-focus-border-color: #fff;
--file-drawer-select-count-color: #fff;
--file-drawer-save-color: #fff;
--preview-item-checked-border-color: #0ed893;
--file-item-preview-bg: #fff;
--file-item-preview-border: #f2f2f2;
--file-item-preview-text: #000;
--file-item-preview-sub-text: #999;
--translate-modal-shadow: rgba(0, 0, 0, 0.3);
--translate-modal-popup-bg: #313131;
--translate-modal-border-color: #444;
--translate-modal-title-color: #fff;
--translate-modal-translate-bg-color: #222;
--translate-modal-translate-text-color: #fff;
--modal-dim: rgba(0, 0, 0, 0.7);
--modal-shadow: rgba(0, 0, 0, 0.3);
--modal-bg: #313131;
--modal-border: #444;
--modal-title: #fff;
--modal-content: #fff;
--modal-button-primary: #fff;
--invite-popup-input-bg: #000;
--invite-popup-input-border: #444;
--invite-popup-input-color: #aaa;
--secret-bg-color: #222;
--secret-text-color: #fff;
--checkbox-border-color: #ddd;
--checkbox-bg-color: #fff;
--user-item-border-color: #444;
--user-item-nickname-color: #fff;
--user-item-translate-color: #aaa;
--toggle-bar-color: #666;
--toggle-bar-on-color: #fff;
--toggle-dot-color: #999;
--toggle-dot-on-color: #0ed893;
--toggle-label-color: #ddd;
--whisper-modal-input-text-color: #fff;
--whisper-modal-input-bg-color: #191919;
--whisper-modal-input-border-color: #444;
--user-popup-shadow: rgba(0, 0, 0, 0.3);
--user-popup-border: #444;
--user-popup-bg: #313131;
--user-popup-text: #fff;
--user-popup-focus-bg: #313131;
--user-popup-focus-text: #fff;
--user-popup-opacity: 0.7;
--user-popup-focus-opacity: 1;
--user-popup-whisper-normal-img: url("/src/assets/images/ico-whisper-focus.webp");
--user-popup-notify-normal-img: url("/src/assets/images/ico-notify-focus.webp");
--user-popup-whisper-focus-img: url("/src/assets/images/ico-whisper-focus.webp");
--user-popup-notify-focus-img: url("/src/assets/images/ico-notify-focus.webp");
--chatting-field-bg: #292929;
--chatting-field-nickname: #aaa;
--chatting-field-input-text: #fff;
--chatting-field-input-placeholder: #aaa;
--chatting-field-border-color: #444;
--chatting-field-input-size-color: #ddd;
--emoticon-field-border-color: #444;
--emoticon-field-hover-bg-color: rgba(255, 255, 255, 0.1);
--emoticon-field-list-bg-color: #353535;
--emoticon-field-list-opacity: 0.5;
--emoticon-field-focus-border-color: #353535;
--emoticon-field-focus-box-shadow: 1px 1.7px 1px 0 rgba(0, 0, 0, 0.3);
--emoticon-field-focus-bg-color: #292929;
--scroll-down-bg: #353535;
--scroll-down-text: #aaa;
--scroll-down-border: #353535;
--scroll-down-shadow: rgba(0, 0, 0, 0.25);
--chatting-header-bg: #191919;
--chatting-header-border: #444;
--chatting-header-text: #fff;
--chatting-header-user-count: #ddd;
--chatting-body-bg: #292929;
--notice-item-bg: #111;
--notice-item-content: #fff;
--notice-item-shadow: rgba(0, 0, 0, 0.3);
--chat-base-border: #444;
--chat-base-nickname: #aaa;
--chat-base-time: #aaa;
--text-chat-item-message: #fff;
--whisper-item-from: #384150;
--whisper-item-nickname-from: #dfb84e;
--whisper-item-to: #353535;
--whisper-item-nickname-to: #00ffc0;
--whisper-item-nickname-where: #aaa;
--whisper-item-message: #fff;
--whisper-item-time: #aaa;
--whisper-item-shadow: rgba(0, 0, 0, 0.3);
--join-item-message: #00ffc0;
--exit-item-message: #ff3a54;
--alert-item-message: #fff000;
--open-graph-item-border: #444;
--open-graph-item-shadow: rgba(0, 0, 0, 0.3);
--open-graph-item-background: #fff;
--open-graph-item-title: #333;
--open-graph-item-desc: #666;
--radio-group-border: #ddd;
--radio-group-checked: #000;
--radio-group-radio-bg: #fff;
--radio-group-text: #fff;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
원하는 CSS 변수를 선택하여 프로젝트의 CSS 파일 또는 컴포넌트의 스타일 내에서 다음과 같이 값을 재정의할 수 있습니다.
css
:root,
:root .light {
--button-primary: skyblue;
}
/* 다크모드 색상 */
:root .dark {
--button-primary: beige;
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
위와 같이 :root 셀렉터 또는 :root .light, :root .dark 셀렉터를 사용하여 특정 모드에 따라 색상을 다르게 설정할 수 있습니다.