-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ajaynegi45/card
Update Home Page
- Loading branch information
Showing
7 changed files
with
209 additions
and
33 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use client"; | ||
|
||
import { useState, useEffect } from 'react'; | ||
|
||
const ScreenWidth: React.FC = () => { | ||
const [screenWidth, setScreenWidth] = useState<number>(0); | ||
|
||
useEffect(() => { | ||
// Function to update the screen width | ||
const updateWidth = () => setScreenWidth(window.innerWidth); | ||
|
||
// Set the initial width | ||
updateWidth(); | ||
|
||
// Add event listener to track window resize | ||
window.addEventListener('resize', updateWidth); | ||
|
||
// Cleanup event listener on component unmount | ||
return () => window.removeEventListener('resize', updateWidth); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<h1>Screen Width: {screenWidth}px</h1> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ScreenWidth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters