Skip to content

Commit

Permalink
Merge pull request #12 from gmook9/dev
Browse files Browse the repository at this point in the history
changes to home
  • Loading branch information
gmook9 authored Aug 11, 2024
2 parents 1529ba8 + 79a6f06 commit 840b400
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ const Card: React.FC<CardProps> = ({ imageUrl, cardName, cardBodyText, btnColor,
);
};

export default Card;
export default Card;
2 changes: 1 addition & 1 deletion src/app/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const CodeBlock: React.FC = () => {
);
};

export default CodeBlock;
export default CodeBlock;
102 changes: 97 additions & 5 deletions src/app/home/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,106 @@
import React from 'react';
'use client'
import React, { useEffect, useMemo, useState } from 'react';
import Particles, { initParticlesEngine } from '@tsparticles/react';
import { loadSlim } from '@tsparticles/slim';
import { type ISourceOptions, MoveDirection, OutMode } from '@tsparticles/engine';
import Card from '../components/Card';
import Avatar from '../components/Avatar';

const Home: React.FC = () => {
const [init, setInit] = useState(false);

useEffect(() => {
initParticlesEngine(async (engine) => {
await loadSlim(engine);
}).then(() => {
setInit(true);
});
}, []);

const particlesLoaded = async (container?: any): Promise<void> => {
console.log(container);
};

const options: ISourceOptions = useMemo(
() => ({
background: {
color: {
value: '#1a202c',
},
},
fpsLimit: 120,
interactivity: {
events: {
onClick: {
enable: true,
mode: 'push',
},
onHover: {
enable: true,
mode: 'repulse',
},
},
modes: {
push: {
quantity: 4,
},
repulse: {
distance: 200,
duration: 0.4,
},
},
},
particles: {
color: {
value: '#ffffff',
},
links: {
color: '#ffffff',
distance: 150,
enable: true,
opacity: 0.5,
width: 1,
},
move: {
direction: MoveDirection.none,
enable: true,
outModes: {
default: OutMode.out,
},
random: true,
speed: 1,
straight: false,
},
number: {
density: {
enable: true,
},
value: 80,
},
opacity: {
value: 0.5,
},
shape: {
type: 'star',
},
size: {
value: { min: 1, max: 5 },
},
},
detectRetina: true,
}),
[]
);

return (
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-900 text-white pb-16">
<div className="mb-8 pt-4">
<div className="relative flex flex-col items-center justify-center min-h-screen bg-gray-900 text-white pb-16 overflow-hidden">
{init && (
<Particles id="tsparticles" particlesLoaded={particlesLoaded} options={options} />
)}
<div className="relative z-10 mb-8 pt-4">
<Avatar />
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
<div className="relative z-10 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
<Card
imageUrl="/images/githubLogo.png"
cardName="GitHub"
Expand Down Expand Up @@ -54,4 +146,4 @@ const Home: React.FC = () => {
);
};

export default Home;
export default Home;

0 comments on commit 840b400

Please sign in to comment.