this.gui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/package.json +27 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +38 -0
- package/public/manifest.json +15 -0
- package/src/App.tsx +22 -0
- package/src/components/AvatarWithStatus.tsx +26 -0
- package/src/components/ChatBubble.tsx +135 -0
- package/src/components/ChatListItem.tsx +87 -0
- package/src/components/ChatsPane.tsx +110 -0
- package/src/components/ColorSchemeToggle.tsx +61 -0
- package/src/components/Header.tsx +47 -0
- package/src/components/MessageInput.tsx +97 -0
- package/src/components/MessagesPane.tsx +87 -0
- package/src/components/MessagesPaneHeader.tsx +105 -0
- package/src/components/MuiLogo.tsx +34 -0
- package/src/components/MyMessages.tsx +49 -0
- package/src/components/Sidebar.tsx +320 -0
- package/src/createServiceWorker.js +52 -0
- package/src/data.tsx +272 -0
- package/src/index.tsx +12 -0
- package/src/package.json +22 -0
- package/src/public/index.html +22 -0
- package/src/tsconfig.json +25 -0
- package/src/types.tsx +25 -0
- package/src/useScript.ts +101 -0
- package/src/utils.ts +53 -0
package/src/data.tsx
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { ChatProps, UserProps } from './types';
|
|
2
|
+
|
|
3
|
+
export const users: UserProps[] = [
|
|
4
|
+
{
|
|
5
|
+
name: 'Steve E.',
|
|
6
|
+
username: '@steveEberger',
|
|
7
|
+
avatar: '/static/images/avatar/2.jpg',
|
|
8
|
+
online: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'Katherine Moss',
|
|
12
|
+
username: '@kathy',
|
|
13
|
+
avatar: '/static/images/avatar/3.jpg',
|
|
14
|
+
online: false,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Phoenix Baker',
|
|
18
|
+
username: '@phoenix',
|
|
19
|
+
avatar: '/static/images/avatar/1.jpg',
|
|
20
|
+
online: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Eleanor Pena',
|
|
24
|
+
username: '@eleanor',
|
|
25
|
+
avatar: '/static/images/avatar/4.jpg',
|
|
26
|
+
online: false,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Kenny Peterson',
|
|
30
|
+
username: '@kenny',
|
|
31
|
+
avatar: '/static/images/avatar/5.jpg',
|
|
32
|
+
online: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Al Sanders',
|
|
36
|
+
username: '@al',
|
|
37
|
+
avatar: '/static/images/avatar/6.jpg',
|
|
38
|
+
online: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Melissa Van Der Berg',
|
|
42
|
+
username: '@melissa',
|
|
43
|
+
avatar: '/static/images/avatar/7.jpg',
|
|
44
|
+
online: false,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const chats: ChatProps[] = [
|
|
49
|
+
{
|
|
50
|
+
id: '1',
|
|
51
|
+
sender: users[0],
|
|
52
|
+
messages: [
|
|
53
|
+
{
|
|
54
|
+
id: '1',
|
|
55
|
+
content: 'Hi Olivia, I am currently working on the project.',
|
|
56
|
+
timestamp: 'Wednesday 9:00am',
|
|
57
|
+
sender: users[0],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: '2',
|
|
61
|
+
content: 'That sounds great, Mabel! Keep up the good work.',
|
|
62
|
+
timestamp: 'Wednesday 9:10am',
|
|
63
|
+
sender: 'You',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: '3',
|
|
67
|
+
timestamp: 'Wednesday 11:30am',
|
|
68
|
+
sender: users[0],
|
|
69
|
+
content: 'I will send the draft by end of the day.',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: '4',
|
|
73
|
+
timestamp: 'Wednesday 2:00pm',
|
|
74
|
+
sender: 'You',
|
|
75
|
+
content: 'Sure, I will be waiting for it.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: '5',
|
|
79
|
+
timestamp: 'Wednesday 4:30pm',
|
|
80
|
+
sender: users[0],
|
|
81
|
+
content: 'Just a heads up, I am about to send the draft.',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: '6',
|
|
85
|
+
content:
|
|
86
|
+
'Thanks Olivia! Almost there. I’ll work on making those changes you suggested and will shoot it over.',
|
|
87
|
+
timestamp: 'Thursday 10:16am',
|
|
88
|
+
sender: users[0],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: '7',
|
|
92
|
+
content:
|
|
93
|
+
'Hey Olivia, I’ve finished with the requirements doc! I made some notes in the gdoc as well for Phoenix to look over.',
|
|
94
|
+
timestamp: 'Thursday 11:40am',
|
|
95
|
+
sender: users[0],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: '3',
|
|
99
|
+
timestamp: 'Thursday 11:40am',
|
|
100
|
+
sender: users[0],
|
|
101
|
+
content: 'Tech requirements.pdf',
|
|
102
|
+
attachment: {
|
|
103
|
+
fileName: 'Tech requirements.pdf',
|
|
104
|
+
type: 'pdf',
|
|
105
|
+
size: '1.2 MB',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: '8',
|
|
110
|
+
timestamp: 'Thursday 11:41am',
|
|
111
|
+
sender: 'You',
|
|
112
|
+
content: 'Awesome! Thanks. I’ll look at this today.',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: '9',
|
|
116
|
+
timestamp: 'Thursday 11:44am',
|
|
117
|
+
sender: users[0],
|
|
118
|
+
content: 'No rush though — we still have to wait for Lana’s designs.',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: '10',
|
|
122
|
+
timestamp: 'Today 2:20pm',
|
|
123
|
+
sender: users[0],
|
|
124
|
+
content: 'Hey Olivia, can you please review the latest design when you can?',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: '11',
|
|
128
|
+
timestamp: 'Just now',
|
|
129
|
+
sender: 'You',
|
|
130
|
+
content: 'Sure thing, I’ll have a look today. They’re looking great!',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: '2',
|
|
136
|
+
sender: users[1],
|
|
137
|
+
messages: [
|
|
138
|
+
{
|
|
139
|
+
id: '1',
|
|
140
|
+
content: 'Hi Olivia, I am thinking about taking a vacation.',
|
|
141
|
+
timestamp: 'Wednesday 9:00am',
|
|
142
|
+
sender: users[1],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: '2',
|
|
146
|
+
content:
|
|
147
|
+
'That sounds like a great idea, Katherine! Any idea where you want to go?',
|
|
148
|
+
timestamp: 'Wednesday 9:05am',
|
|
149
|
+
sender: 'You',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: '3',
|
|
153
|
+
content: 'I am considering a trip to the beach.',
|
|
154
|
+
timestamp: 'Wednesday 9:30am',
|
|
155
|
+
sender: users[1],
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: '4',
|
|
159
|
+
content: 'The beach sounds perfect this time of year!',
|
|
160
|
+
timestamp: 'Wednesday 9:35am',
|
|
161
|
+
sender: 'You',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: '5',
|
|
165
|
+
content: 'Yes, I agree. It will be a much-needed break.',
|
|
166
|
+
timestamp: 'Wednesday 10:00am',
|
|
167
|
+
sender: users[1],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: '6',
|
|
171
|
+
content: 'Make sure to take lots of pictures!',
|
|
172
|
+
timestamp: 'Wednesday 10:05am',
|
|
173
|
+
sender: 'You',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: '3',
|
|
179
|
+
sender: users[2],
|
|
180
|
+
messages: [
|
|
181
|
+
{
|
|
182
|
+
id: '1',
|
|
183
|
+
content: 'Hey!',
|
|
184
|
+
timestamp: '5 mins ago',
|
|
185
|
+
sender: users[2],
|
|
186
|
+
unread: true,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: '4',
|
|
192
|
+
sender: users[3],
|
|
193
|
+
messages: [
|
|
194
|
+
{
|
|
195
|
+
id: '1',
|
|
196
|
+
content:
|
|
197
|
+
'Hey Olivia, I was thinking about doing some home improvement work.',
|
|
198
|
+
timestamp: 'Wednesday 9:00am',
|
|
199
|
+
sender: users[3],
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: '2',
|
|
203
|
+
content:
|
|
204
|
+
'That sounds interesting! What kind of improvements are you considering?',
|
|
205
|
+
timestamp: 'Wednesday 9:05am',
|
|
206
|
+
sender: 'You',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: '3',
|
|
210
|
+
content: 'I am planning to repaint the walls and replace the old furniture.',
|
|
211
|
+
timestamp: 'Wednesday 9:15am',
|
|
212
|
+
sender: users[3],
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: '4',
|
|
216
|
+
content:
|
|
217
|
+
'That will definitely give your house a fresh look. Do you need help with anything?',
|
|
218
|
+
timestamp: 'Wednesday 9:20am',
|
|
219
|
+
sender: 'You',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: '5',
|
|
223
|
+
content:
|
|
224
|
+
'I might need some help with picking the right paint colors. Can we discuss this over the weekend?',
|
|
225
|
+
timestamp: 'Wednesday 9:30am',
|
|
226
|
+
sender: users[3],
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
{
|
|
232
|
+
id: '5',
|
|
233
|
+
sender: users[4],
|
|
234
|
+
messages: [
|
|
235
|
+
{
|
|
236
|
+
id: '1',
|
|
237
|
+
content: 'Sup',
|
|
238
|
+
timestamp: '5 mins ago',
|
|
239
|
+
sender: users[4],
|
|
240
|
+
unread: true,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: '6',
|
|
246
|
+
sender: users[5],
|
|
247
|
+
messages: [
|
|
248
|
+
{
|
|
249
|
+
id: '1',
|
|
250
|
+
content: 'Heyo',
|
|
251
|
+
timestamp: '5 mins ago',
|
|
252
|
+
sender: 'You',
|
|
253
|
+
unread: true,
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
{
|
|
259
|
+
id: '7',
|
|
260
|
+
sender: users[6],
|
|
261
|
+
messages: [
|
|
262
|
+
{
|
|
263
|
+
id: '1',
|
|
264
|
+
content:
|
|
265
|
+
'Hey Olivia, I’ve finished with the requirements doc! I made some notes in the gdoc as well for Phoenix to look over.',
|
|
266
|
+
timestamp: '5 mins ago',
|
|
267
|
+
sender: users[6],
|
|
268
|
+
unread: true,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
},
|
|
272
|
+
];
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
import { StyledEngineProvider } from '@mui/joy/styles';
|
|
4
|
+
import App from './App';
|
|
5
|
+
|
|
6
|
+
ReactDOM.createRoot(document.querySelector("#root")!).render(
|
|
7
|
+
<React.StrictMode>
|
|
8
|
+
<StyledEngineProvider injectFirst>
|
|
9
|
+
<App />
|
|
10
|
+
</StyledEngineProvider>
|
|
11
|
+
</React.StrictMode>
|
|
12
|
+
);
|
package/src/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"@emotion/react": "latest",
|
|
4
|
+
"@emotion/styled": "latest",
|
|
5
|
+
"@mui/icons-material": "latest",
|
|
6
|
+
"@mui/joy": "latest",
|
|
7
|
+
"@mui/material": "latest",
|
|
8
|
+
"@types/react": "latest",
|
|
9
|
+
"@types/react-dom": "latest",
|
|
10
|
+
"react": "latest",
|
|
11
|
+
"react-dom": "latest",
|
|
12
|
+
"typescript": "latest"
|
|
13
|
+
},
|
|
14
|
+
"description": "https://github.com/mui/material-ui/blob/v5.14.10/docs/data/joy/templates/messages/App.tsx",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"react-scripts": "latest"
|
|
17
|
+
},
|
|
18
|
+
"main": "index.tsx",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"start": "react-scripts start"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Messages Template - Joy UI</title>
|
|
5
|
+
<meta name="viewport" content="initial-scale=1, width=device-width" />
|
|
6
|
+
<!-- Fonts to support Material Design -->
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
|
+
<link
|
|
10
|
+
rel="stylesheet"
|
|
11
|
+
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap"
|
|
12
|
+
/>
|
|
13
|
+
<!-- Icons to support Material Design -->
|
|
14
|
+
<link
|
|
15
|
+
rel="stylesheet"
|
|
16
|
+
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
|
17
|
+
/>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="root"></div>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"noEmit": true,
|
|
20
|
+
"jsx": "react"
|
|
21
|
+
},
|
|
22
|
+
"include": [
|
|
23
|
+
"src"
|
|
24
|
+
]
|
|
25
|
+
}
|
package/src/types.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type UserProps = {
|
|
2
|
+
name: string;
|
|
3
|
+
username: string;
|
|
4
|
+
avatar: string;
|
|
5
|
+
online: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type MessageProps = {
|
|
9
|
+
id: string;
|
|
10
|
+
content: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
unread?: boolean;
|
|
13
|
+
sender: UserProps | 'You';
|
|
14
|
+
attachment?: {
|
|
15
|
+
fileName: string;
|
|
16
|
+
type: string;
|
|
17
|
+
size: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ChatProps = {
|
|
22
|
+
id: string;
|
|
23
|
+
sender: UserProps;
|
|
24
|
+
messages: MessageProps[];
|
|
25
|
+
};
|
package/src/useScript.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type UseScriptStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
4
|
+
|
|
5
|
+
// Cached script statuses
|
|
6
|
+
const cachedScriptStatuses: Record<string, UseScriptStatus | undefined> = {};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Simplified version of https://usehooks-ts.com/react-hook/use-script
|
|
10
|
+
*/
|
|
11
|
+
function getScriptNode(src: string) {
|
|
12
|
+
const node: HTMLScriptElement | null = document.querySelector(`script[src="${src}"]`);
|
|
13
|
+
const status = node?.getAttribute('data-status') as UseScriptStatus | undefined;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
node,
|
|
17
|
+
status,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function useScript(src: string): UseScriptStatus {
|
|
22
|
+
const [status, setStatus] = React.useState<UseScriptStatus>(() => {
|
|
23
|
+
if (typeof window === 'undefined') {
|
|
24
|
+
// SSR Handling - always return 'loading'
|
|
25
|
+
return 'loading';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return cachedScriptStatuses[src] ?? 'loading';
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
const cachedScriptStatus = cachedScriptStatuses[src];
|
|
33
|
+
if (cachedScriptStatus === 'ready' || cachedScriptStatus === 'error') {
|
|
34
|
+
// If the script is already cached, set its status immediately
|
|
35
|
+
setStatus(cachedScriptStatus);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Fetch existing script element by src
|
|
40
|
+
// It may have been added by another instance of this hook
|
|
41
|
+
const script = getScriptNode(src);
|
|
42
|
+
let scriptNode = script.node;
|
|
43
|
+
|
|
44
|
+
if (!scriptNode) {
|
|
45
|
+
// Create script element and add it to document body
|
|
46
|
+
scriptNode = document.createElement('script');
|
|
47
|
+
scriptNode.src = src;
|
|
48
|
+
scriptNode.async = true;
|
|
49
|
+
scriptNode.setAttribute('data-status', 'loading');
|
|
50
|
+
document.body.appendChild(scriptNode);
|
|
51
|
+
|
|
52
|
+
// Store status in attribute on script
|
|
53
|
+
// This can be read by other instances of this hook
|
|
54
|
+
const setAttributeFromEvent = (event: Event) => {
|
|
55
|
+
const scriptStatus: UseScriptStatus = event.type === 'load' ? 'ready' : 'error';
|
|
56
|
+
|
|
57
|
+
scriptNode?.setAttribute('data-status', scriptStatus);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
scriptNode.addEventListener('load', setAttributeFromEvent);
|
|
61
|
+
scriptNode.addEventListener('error', setAttributeFromEvent);
|
|
62
|
+
} else {
|
|
63
|
+
// Grab existing script status from attribute and set to state.
|
|
64
|
+
setStatus(script.status ?? cachedScriptStatus ?? 'loading');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Script event handler to update status in state
|
|
68
|
+
// Note: Even if the script already exists we still need to add
|
|
69
|
+
// event handlers to update the state for *this* hook instance.
|
|
70
|
+
const setStateFromEvent = (event: Event) => {
|
|
71
|
+
const newStatus = event.type === 'load' ? 'ready' : 'error';
|
|
72
|
+
setStatus(newStatus);
|
|
73
|
+
cachedScriptStatuses[src] = newStatus;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Add event listeners
|
|
77
|
+
scriptNode.addEventListener('load', setStateFromEvent);
|
|
78
|
+
scriptNode.addEventListener('error', setStateFromEvent);
|
|
79
|
+
|
|
80
|
+
// Remove event listeners on cleanup
|
|
81
|
+
// eslint-disable-next-line consistent-return
|
|
82
|
+
return () => {
|
|
83
|
+
if (scriptNode) {
|
|
84
|
+
scriptNode.removeEventListener('load', setStateFromEvent);
|
|
85
|
+
scriptNode.removeEventListener('error', setStateFromEvent);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (scriptNode) {
|
|
89
|
+
try {
|
|
90
|
+
scriptNode.remove();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
// ignore error
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, [src]);
|
|
97
|
+
|
|
98
|
+
return status;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default useScript;
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const openSidebar = () => {
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
document.body.style.overflow = 'hidden';
|
|
4
|
+
document.documentElement.style.setProperty('--SideNavigation-slideIn', '1');
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const closeSidebar = () => {
|
|
9
|
+
if (typeof document !== 'undefined') {
|
|
10
|
+
document.documentElement.style.removeProperty('--SideNavigation-slideIn');
|
|
11
|
+
document.body.style.removeProperty('overflow');
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const toggleSidebar = () => {
|
|
16
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
17
|
+
const slideIn = window
|
|
18
|
+
.getComputedStyle(document.documentElement)
|
|
19
|
+
.getPropertyValue('--SideNavigation-slideIn');
|
|
20
|
+
if (slideIn) {
|
|
21
|
+
closeSidebar();
|
|
22
|
+
} else {
|
|
23
|
+
openSidebar();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const openMessagesPane = () => {
|
|
29
|
+
if (typeof document !== 'undefined') {
|
|
30
|
+
document.body.style.overflow = 'hidden';
|
|
31
|
+
document.documentElement.style.setProperty('--MessagesPane-slideIn', '1');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const closeMessagesPane = () => {
|
|
36
|
+
if (typeof document !== 'undefined') {
|
|
37
|
+
document.documentElement.style.removeProperty('--MessagesPane-slideIn');
|
|
38
|
+
document.body.style.removeProperty('overflow');
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const toggleMessagesPane = () => {
|
|
43
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
44
|
+
const slideIn = window
|
|
45
|
+
.getComputedStyle(document.documentElement)
|
|
46
|
+
.getPropertyValue('--MessagesPane-slideIn');
|
|
47
|
+
if (slideIn) {
|
|
48
|
+
closeMessagesPane();
|
|
49
|
+
} else {
|
|
50
|
+
openMessagesPane();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|