Skip to content

Commit

Permalink
losing useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
jonolane committed Dec 14, 2023
1 parent c5201e5 commit 2bf0f99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const IndexPage: React.FC<PageProps> = () => {

return (
<div className="min-h-screen relative">
{/* removed in dev for before::body styling <div className={`absolute inset-0 bg-[url('../images/gradient3.jpg')] bg-cover bg-repeat-round opacity-70`} /> */}
{/* pre-use of head <div className={`absolute inset-0 bg-[url('../images/gradient3.jpg')] bg-cover bg-repeat-round opacity-70`} />*/}
<div className={`relative ${isDarkMode ? 'bg-black text-white' : ''}`}>
<div className="flex flex-col sm:items-center justify-center sm:p-6 z-50">
<Navbar />
Expand Down Expand Up @@ -94,9 +94,12 @@ const Head: React.FC<HeadProps> = () => {
const appContext = useContext(AppContext);
const { isDarkMode } = appContext || {};

// attempting to drop useEffect to improve performance
/*
useEffect(() => {
document.body.className = isDarkMode ? 'before:bg-black text-white before:z-[-1]' : 'before:fixed before:bg-[url("../images/gradient3.jpg")] before:bg-cover before:bg-repeat-round before:opacity-60 before:z-[-1] before:inset-0';
}, [isDarkMode]);
*/

return (
<>
Expand All @@ -121,7 +124,7 @@ const Head: React.FC<HeadProps> = () => {
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap" rel="stylesheet" />

{/*<body className={`${isDarkMode ? 'before:bg-black text-white' : 'before:fixed before:bg-[url("../images/gradient3.jpg")] before:bg-cover before:bg-repeat-round before:opacity-60 before:z-[-1] before:inset-0'}`} />*/}
<body className={`${isDarkMode ? 'before:bg-black text-white' : 'before:fixed before:bg-[url("../images/gradient3.jpg")] before:bg-cover before:bg-repeat-round before:opacity-60 before:z-[-1] before:inset-0'}`} />
</>
)
}
Expand Down

0 comments on commit 2bf0f99

Please sign in to comment.