Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/components/GlowingCursor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { useEffect } from 'react';
import '../css/custom.css';

const CursorComponent = () => {
useEffect(() => {
const cursor = document.querySelector('.cursor');

const moveCursor = (e) => {
cursor.style.left = e.pageX + 'px';
cursor.style.top = e.pageY + 'px';
};

document.addEventListener('mousemove', moveCursor);

return () => {
document.removeEventListener('mousemove', moveCursor);
};
}, []);

return (
<div className="cursor-container">
<div className="cursor"></div>
</div>
);
};

export default CursorComponent;
27 changes: 27 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,30 @@ th {
.row .col .card {
margin-top: 10px;
}

/* Define the glowing cursor */
html {
cursor: none;
}

.cursor {
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: deepskyblue;
mix-blend-mode: difference;
pointer-events: none;
transform: translate(-50%, -50%);
transition: width 0.3s, height 0.3s, background-color 0.3s;
animation: glow 1s infinite alternate;
}

@keyframes glow {
0% {
box-shadow: 0 0 10px 5px rgba(0, 191, 255, 0.5);
}
100% {
box-shadow: 0 0 20px 10px rgba(0, 191, 255, 0.9);
}
}
3 changes: 2 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'swiper/css/navigation';
import 'swiper/css/pagination';
import { Swiper, SwiperSlide } from 'swiper/react';
import { Navigation, Pagination, Autoplay } from 'swiper/modules';
import CursorComponent from '../components/GlowingCursor'

function TweetsSection() {
const tweetColumns = [[], [], []];
Expand Down Expand Up @@ -107,7 +108,7 @@ export default function Home() {
</div>

<TweetsSection />

<CursorComponent/>
<ScrollTopToButton />
<ScrollBottomToTop />
</main>
Expand Down