forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
248 lines (244 loc) · 7.26 KB
/
App.tsx
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
import * as React from 'react';
import { CssVarsProvider, useColorScheme } from '@mui/joy/styles';
import CssBaseline from '@mui/joy/CssBaseline';
import Box from '@mui/joy/Box';
import Typography from '@mui/joy/Typography';
import Input from '@mui/joy/Input';
import IconButton from '@mui/joy/IconButton';
// Icons import
import SearchRoundedIcon from '@mui/icons-material/SearchRounded';
import DarkModeRoundedIcon from '@mui/icons-material/DarkModeRounded';
import LightModeRoundedIcon from '@mui/icons-material/LightModeRounded';
import GridViewRoundedIcon from '@mui/icons-material/GridViewRounded';
import MailRoundedIcon from '@mui/icons-material/MailRounded';
import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
import MenuIcon from '@mui/icons-material/Menu';
import BookRoundedIcon from '@mui/icons-material/BookRounded';
// custom
import emailTheme from './theme';
import Menu from './components/Menu';
import Layout from './components/Layout';
import Navigation from './components/Navigation';
import Mails from './components/Mails';
import EmailContent from './components/EmailContent';
function ColorSchemeToggle() {
const { mode, setMode } = useColorScheme();
const [mounted, setMounted] = React.useState(false);
React.useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return <IconButton size="sm" variant="outlined" color="primary" />;
}
return (
<IconButton
id="toggle-mode"
size="sm"
variant="outlined"
color="primary"
onClick={() => {
if (mode === 'light') {
setMode('dark');
} else {
setMode('light');
}
}}
>
{mode === 'light' ? <DarkModeRoundedIcon /> : <LightModeRoundedIcon />}
</IconButton>
);
}
export default function EmailExample() {
const [drawerOpen, setDrawerOpen] = React.useState(false);
return (
<CssVarsProvider disableTransitionOnChange theme={emailTheme}>
<CssBaseline />
{drawerOpen && (
<Layout.SideDrawer onClose={() => setDrawerOpen(false)}>
<Navigation />
</Layout.SideDrawer>
)}
<Layout.Root
sx={{
...(drawerOpen && {
height: '100vh',
overflow: 'hidden',
}),
}}
>
<Layout.Header>
<Box
sx={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: 1.5,
}}
>
<IconButton
variant="outlined"
size="sm"
onClick={() => setDrawerOpen(true)}
sx={{ display: { sm: 'none' } }}
>
<MenuIcon />
</IconButton>
<IconButton
size="sm"
variant="solid"
sx={{ display: { xs: 'none', sm: 'inline-flex' } }}
>
<MailRoundedIcon />
</IconButton>
<Typography component="h1" fontWeight="xl">
Email
</Typography>
</Box>
<Input
size="sm"
placeholder="Search anything…"
startDecorator={<SearchRoundedIcon color="primary" />}
endDecorator={
<IconButton variant="outlined" size="sm" color="neutral">
<Typography fontWeight="lg" fontSize="sm" textColor="text.tertiary">
/
</Typography>
</IconButton>
}
sx={{
flexBasis: '500px',
display: {
xs: 'none',
sm: 'flex',
},
}}
/>
<Box sx={{ display: 'flex', flexDirection: 'row', gap: 1.5 }}>
<IconButton
size="sm"
variant="outlined"
color="primary"
sx={{ display: { xs: 'inline-flex', sm: 'none' } }}
>
<SearchRoundedIcon />
</IconButton>
<IconButton
size="sm"
variant="outlined"
color="primary"
component="a"
href="/blog/first-look-at-joy/"
>
<BookRoundedIcon />
</IconButton>
<Menu
id="app-selector"
control={
<IconButton
size="sm"
variant="outlined"
color="primary"
aria-label="Apps"
>
<GridViewRoundedIcon />
</IconButton>
}
menus={[
{
label: 'Email',
active: true,
href: '/joy-ui/getting-started/templates/email/',
'aria-current': 'page',
},
{
label: 'Team',
href: '/joy-ui/getting-started/templates/team/',
},
{
label: 'Files',
href: '/joy-ui/getting-started/templates/files/',
},
]}
/>
<ColorSchemeToggle />
</Box>
</Layout.Header>
<Layout.SideNav>
<Navigation />
</Layout.SideNav>
<Layout.SidePane>
<Box
sx={{
p: 2,
mb: 1,
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<Typography
textColor="neutral.500"
fontWeight={700}
sx={{
fontSize: '10px',
textTransform: 'uppercase',
letterSpacing: '.1rem',
}}
>
Unread
</Typography>
<IconButton
size="sm"
variant="plain"
color="primary"
sx={{ '--IconButton-size': '24px' }}
>
<KeyboardArrowDownRoundedIcon fontSize="small" color="primary" />
</IconButton>
</Box>
<Box sx={{ py: 10 }}>
<Typography
textColor="text.tertiary"
level="body2"
sx={{ textAlign: 'center' }}
>
You've read all messages in your inbox.
</Typography>
</Box>
<Box
sx={{
p: 2,
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<Typography
textColor="neutral.500"
fontWeight={700}
sx={{
fontSize: '10px',
textTransform: 'uppercase',
letterSpacing: '.1rem',
}}
>
Everything else
</Typography>
<IconButton
size="sm"
variant="plain"
color="primary"
sx={{ '--IconButton-size': '24px' }}
>
<KeyboardArrowDownRoundedIcon fontSize="small" color="primary" />
</IconButton>
</Box>
<Mails />
</Layout.SidePane>
<Layout.Main>
<EmailContent />
</Layout.Main>
</Layout.Root>
</CssVarsProvider>
);
}