Skip to content

Susanta/tiy widnow tape #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 23, 2025
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ npm-shrinkwrap.json

# bun lockfiles
bun.lockb
bun.lock
bun.lock

# pnpm lockfiles
pnpm-lock.yaml
50 changes: 50 additions & 0 deletions src/tryityourself/Susanta/WindowTape.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
useEffect,
useState
} from "react";


function WindowTape() {
const [windowSize, setWindowSize] = useState({
width: window.innerWidth,
height: window.innerHeight
});

useEffect(() => {
const handleResize = () => {
setWindowSize({
width: window.innerWidth,
height: window.innerHeight
});
};
window.addEventListener("resize", handleResize);
return () => {
window.removeEventListener("resize", handleResize);
};
}, []);

return (
<>
<div className="bg-purple-900/70 flex justify-center items-center min-w-screen min-h-screen">
<div className="bg-purple-300 rounded-full p-6 px-10 text-4xl text-bold border-2 border-gray-300">
<table>
<tr>
<td className="p-2">WIDTH</td>
<td className="p-2">{windowSize.width}px</td>
</tr>
<tr>
<td className="p-2">HEIGHT</td>
<td className="p-2">{windowSize.height}px</td>
</tr>
</table>
</div>
</div>
</>
)
}


// best practice to export a component is to use named export
export {
WindowTape
}
Empty file.