mirror of
https://github.com/harivansh-afk/React-Portfolio.git
synced 2026-04-20 20:01:13 +00:00
chore: project page edits etc
This commit is contained in:
parent
7bacec764b
commit
1b599490ae
6 changed files with 248 additions and 118 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import "./style.css";
|
||||
import { Helmet, HelmetProvider } from "react-helmet-async";
|
||||
import Typewriter from "typewriter-effect";
|
||||
|
|
@ -6,6 +6,36 @@ import { introdata, meta } from "../../content_option";
|
|||
import { Link } from "react-router-dom";
|
||||
|
||||
export const Home = () => {
|
||||
const [needsScroll, setNeedsScroll] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const checkOverflow = () => {
|
||||
const body = document.body;
|
||||
const html = document.documentElement;
|
||||
const documentHeight = Math.max(
|
||||
body.scrollHeight,
|
||||
body.offsetHeight,
|
||||
html.clientHeight,
|
||||
html.scrollHeight,
|
||||
html.offsetHeight
|
||||
);
|
||||
const windowHeight = window.innerHeight;
|
||||
setNeedsScroll(documentHeight > windowHeight);
|
||||
};
|
||||
|
||||
// Initial check
|
||||
checkOverflow();
|
||||
|
||||
// Add resize listener
|
||||
window.addEventListener('resize', checkOverflow);
|
||||
|
||||
// Cleanup
|
||||
return () => window.removeEventListener('resize', checkOverflow);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
document.body.style.overflowY = needsScroll ? 'auto' : 'hidden';
|
||||
}, [needsScroll]);
|
||||
return (
|
||||
<HelmetProvider>
|
||||
<section id="home" className="home">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue