-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwindowStack.tsx
57 lines (50 loc) · 1.49 KB
/
windowStack.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
import { Context } from '../../lib/store';
import Draggable from '../../lib/draggable';
import { useContext } from 'react';
import {useTheme} from 'next-themes';
import ChangeBackground from './changeBackground';
import Mail from './mail';
import Terminal from './terminal';
import Profile from './profile';
import React from 'react';
export const WindowStacks = () => {
const { theme, setTheme } = useTheme();
const {state, dispatch} = useContext(Context) as AppStoreContextType;
React.useEffect(() => {
setTheme('dark');
}, []);
const getComponent = (id: string) => {
switch(id){
case 'PROFILE':
return <Profile/>
case 'TERMINAL':
return <Terminal context={{
height: '',
width: ''
}}/>
case 'CHANGE_BACKGROUND':
return <ChangeBackground context={{
height: 0,
width: 0
}}/>
case 'MAIL':
return <Mail context={{
height: '',
width: ''
}} />
default:
return <div>Some Content</div>
}
}
return (
<div className="relative bg-transparent" style={{zIndex :2}}>
<div>
{state.windowsOpen.map(w =>
<Draggable key={w.id} id={w.id} header={w.header} title={w.title} >
{getComponent(w.id)}
</Draggable>
)}
</div>
</div>
);
}