Skip to content

Commit cf3d719

Browse files
committed
Merge pull request #16 from IgorD-lab/feat/home
added desktop folders and their functionalities
2 parents 3add8fa + c6dd0d4 commit cf3d719

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

src/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import gsap from 'gsap';
22
import { Draggable } from 'gsap/Draggable';
33

4-
import { Navbar, Welcome, Dock } from '#components';
4+
import { Navbar, Welcome, Dock, Home } from '#components';
55
import {
66
Terminal,
77
Safari,
@@ -28,6 +28,8 @@ const App = () => {
2828
<Text />
2929
<Image />
3030
<Contact />
31+
32+
<Home />
3133
</main>
3234
);
3335
};

src/components/Home.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { locations } from '#constants';
2+
import clsx from 'clsx';
3+
import { useGSAP } from '@gsap/react';
4+
import { Draggable } from 'gsap/Draggable';
5+
import useWindowStore from '#store/window';
6+
import useLocationStore from '#store/location';
7+
import { FinderItem } from '#types';
8+
9+
const projects = (locations.work?.children as FinderItem[]) ?? [];
10+
const Home = () => {
11+
const { setActiveLocation } = useLocationStore();
12+
const { openWindow } = useWindowStore();
13+
14+
const handleOpenProjectFinder = (project: FinderItem) => {
15+
setActiveLocation(project);
16+
openWindow('finder');
17+
};
18+
useGSAP(() => {
19+
Draggable.create('.folder');
20+
}, []);
21+
return (
22+
<section id="home">
23+
<ul>
24+
{projects.map((project) => (
25+
<li
26+
key={project.id}
27+
className={clsx('group folder', project.windowPosition)}
28+
onClick={() => handleOpenProjectFinder(project)}
29+
>
30+
<img src="/images/folder.png" alt={project.name} />
31+
<p>{project.name}</p>
32+
</li>
33+
))}
34+
</ul>
35+
</section>
36+
);
37+
};
38+
39+
export default Home;

src/components/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import Navbar from '#components/Navbar';
33
import Welcome from '#components/Welcome';
44
import Dock from '#components/Dock';
55
import WindowControls from './WindowControls';
6+
import Home from './Home';
67

7-
export { Navbar, Welcome, Dock, WindowControls };
8+
export { Navbar, Welcome, Dock, WindowControls, Home };

0 commit comments

Comments
 (0)