ok
This commit is contained in:
24
src/components/ButtonWithReplica.js
Normal file
24
src/components/ButtonWithReplica.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import React, { useState } from "react";
|
||||
import "./ButtonWithReplica.css";
|
||||
|
||||
const ButtonWithReplica = ({ children }) => {
|
||||
const [isActive, setIsActive] = useState(false);
|
||||
|
||||
const handleClick = () => {
|
||||
setIsActive(true);
|
||||
setTimeout(() => {
|
||||
setIsActive(false);
|
||||
}, 1000); // Duration of the animation
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<button className="button" onClick={handleClick}>
|
||||
{children}
|
||||
</button>
|
||||
<div className={`replica ${isActive ? "active" : ""}`}></div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ButtonWithReplica;
|
||||
Reference in New Issue
Block a user