Skip to content

Commit

Permalink
Rutas relativas + fondo de partículas
Browse files Browse the repository at this point in the history
  • Loading branch information
CANCI0 committed Apr 5, 2024
1 parent b5188a6 commit d3400fd
Show file tree
Hide file tree
Showing 8 changed files with 871 additions and 1 deletion.
10 changes: 10 additions & 0 deletions webapp/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@components/*": ["components/*"],
"@pages/*": ["pages/*"]
}
},
"include": ["src"]
}
660 changes: 660 additions & 0 deletions webapp/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@tsparticles/react": "^3.0.0",
"@tsparticles/slim": "^3.3.0",
"axios": "^1.6.5",
"framer-motion": "^11.0.19",
"react": "^18.2.0",
Expand Down
1 change: 0 additions & 1 deletion webapp/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Register from "./components/Register/Register.js";
import Perfil from "./pages/Perfil/Perfil.js";
import CalculadoraHumana from "./pages/Calculadora/Calculadora.js";


function App() {
useEffect(() => {
document.title = "WIQ!";
Expand Down
8 changes: 8 additions & 0 deletions webapp/src/components/Background/Background.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#tsparticles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
79 changes: 79 additions & 0 deletions webapp/src/components/Background/Background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { useEffect, useState } from "react";
import Particles, { initParticlesEngine } from "@tsparticles/react";
import { loadSlim } from "@tsparticles/slim";
import { useColorMode } from "@chakra-ui/react";
import "./Background.css";

const Background = () => {
const [ init, setInit ] = useState(false);
const { colorMode, toggleColorMode } = useColorMode();
const isDarkTheme = colorMode === "dark";
const particlesColor = isDarkTheme ? "#FFFFFF" : "#000000";
const bgColor = isDarkTheme ? '#1A202C' : '#FFFFFF';

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

const particlesLoaded = (container) => {
console.log(container);
};

return (
<>
{ init && <Particles
id="tsparticles"
particlesLoaded={particlesLoaded}
options={{
background: {
color: {
value: bgColor,
},
},
fpsLimit: 120,
particles: {
color: {
value: particlesColor,
},
links: {
enable: false,
},
move: {
direction: "none",
enable: true,
outModes: {
default: "bounce",
},
random: false,
speed: 6,
straight: false,
},
number: {
density: {
enable: true,
area: 800,
},
value: 80,
},
opacity: {
value: 0.5,
},
shape: {
type: "circle",
},
size: {
value: { min: 1, max: 5 },
},
},
detectRetina: true,
}}
/>}
</>
);
};

export default Background;
110 changes: 110 additions & 0 deletions webapp/src/components/Background/dots-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#000000"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 3
},
"image": {
"src": "img/github.svg",
"width": 100,
"height": 100
}
},
"opacity": {
"value": 0.49716301422833176,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 3,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": false,
"distance": 150,
"color": "#000000",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 6,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": false,
"mode": "repulse"
},
"onclick": {
"enable": false,
"mode": "push"
},
"resize": true
},
"modes": {
"grab": {
"distance": 400,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200,
"duration": 0.4
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
}
2 changes: 2 additions & 0 deletions webapp/src/pages/Home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Footer from "../../components/Footer/Footer.js";
import CustomModal from "../../components/CustomModal/CustomModal.js";
import { Box, Heading, Flex } from "@chakra-ui/react";
import { useLocation } from "react-router-dom";
import Background from "../../components/Background/Background.js";

const Home = () => {
const location = useLocation();
Expand All @@ -13,6 +14,7 @@ const Home = () => {
return (
<>
<Nav />
<Background />
<Flex direction="column" align="center" justify="center" h="70vh">
<Heading as="h1" mb={2}>
¡Bienvenido a WIQ!
Expand Down

0 comments on commit d3400fd

Please sign in to comment.