toggle styled but no functionality

This commit is contained in:
yousifpa98
2024-12-21 12:16:24 +01:00
parent 6e257453bf
commit 9d7c2b2109
8 changed files with 116 additions and 15 deletions

View File

@@ -49,7 +49,7 @@ const Home = () => {
) : (
<LangSelect
initialAnimation="animate__zoomIn"
/* onMouseEnter={handleMouseEnter} */
/* onMouseEnter={handleMouseEnter} */
onAnimationEnd={handleAnimationEnd}
/>
)}
@@ -58,7 +58,7 @@ const Home = () => {
) : (
<Mail
initialAnimation="animate__zoomIn"
/* onMouseEnter={handleMouseEnter} */
/* onMouseEnter={handleMouseEnter} */
onAnimationEnd={handleAnimationEnd}
/>
)}
@@ -67,7 +67,7 @@ const Home = () => {
) : (
<Switch
initialAnimation="animate__zoomIn"
/* onMouseEnter={handleMouseEnter} */
/* onMouseEnter={handleMouseEnter} */
onAnimationEnd={handleAnimationEnd}
/>
)}

View File

@@ -1,12 +1,21 @@
import React from "react";
import "../css/LangSelect.css";
import { useState } from "react";
import Toggle from "./subComponents/Toggle";
const LangSelect = ({ initialAnimation, onMouseEnter, onAnimationEnd }) => {
const [animation, setAnimation] = useState(initialAnimation);
return <div className={`langSelect container animate__animated ${animation}`}
onMouseEnter={() => onMouseEnter(setAnimation)}
onAnimationEnd={() => onAnimationEnd(setAnimation)}>LangSelect</div>;
const [animation, setAnimation] = useState(initialAnimation);
return (
<div
className={`langSelect container animate__animated ${animation}`}
onMouseEnter={() => onMouseEnter(setAnimation)}
onAnimationEnd={() => onAnimationEnd(setAnimation)}
>
<div className="eng">🇬🇧</div>
<Toggle />
<div className="ger">🇩🇪</div>
</div>
);
};
export default LangSelect;

View File

@@ -6,12 +6,8 @@ import "animate.css";
const Switch = ({ initialAnimation, onMouseEnter, onAnimationEnd }) => {
const [animation, setAnimation] = useState(initialAnimation);
return (
<div
className={`switch container animate__animated ${animation}`}
onMouseEnter={() => onMouseEnter(setAnimation)}
onAnimationEnd={() => onAnimationEnd(setAnimation)}
>
Switch
<div className={`switch container animate__animated ${animation}`}>
switch
</div>
);
};

View File

@@ -36,9 +36,9 @@ const About = () => {
/>
<LangSelect />
<Mail />
<Switch />
<Switch isOn={false} handleToggle={toggleSwitch} />
<Navigation
/* initialAnimation="animate__bounceInDown"
/* initialAnimation="animate__bounceInDown"
onMouseEnter={handleMouseEnter}
onAnimationEnd={handleAnimationEnd} */
/>

View File

@@ -0,0 +1,16 @@
import React, { useState } from "react";
import "../../css/Toggle.css";
const Toggle = () => {
const [toggled, setToggled] = useState(false);
return (
<button
className={`toggle-btn ${toggled ? "toggled" : ""}`}
onClick={() => setToggled(!toggled)}
>
<div className="thumb"></div>
</button>
);
};
export default Toggle;