Skip to content

Commit d07b60d

Browse files
authored
Susanta/tiy widnow tape (#28)
I have successfully removed those lock files.
2 parents b3c3ee8 + 3d81e73 commit d07b60d

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ npm-shrinkwrap.json
2929

3030
# bun lockfiles
3131
bun.lockb
32-
bun.lock
32+
bun.lock
33+
34+
# pnpm lockfiles
35+
pnpm-lock.yaml
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import {
2+
useEffect,
3+
useState
4+
} from "react";
5+
6+
7+
function WindowTape() {
8+
const [windowSize, setWindowSize] = useState({
9+
width: window.innerWidth,
10+
height: window.innerHeight
11+
});
12+
13+
useEffect(() => {
14+
const handleResize = () => {
15+
setWindowSize({
16+
width: window.innerWidth,
17+
height: window.innerHeight
18+
});
19+
};
20+
window.addEventListener("resize", handleResize);
21+
return () => {
22+
window.removeEventListener("resize", handleResize);
23+
};
24+
}, []);
25+
26+
return (
27+
<>
28+
<div className="bg-purple-900/70 flex justify-center items-center min-w-screen min-h-screen">
29+
<div className="bg-purple-300 rounded-full p-6 px-10 text-4xl text-bold border-2 border-gray-300">
30+
<table>
31+
<tr>
32+
<td className="p-2">WIDTH</td>
33+
<td className="p-2">{windowSize.width}px</td>
34+
</tr>
35+
<tr>
36+
<td className="p-2">HEIGHT</td>
37+
<td className="p-2">{windowSize.height}px</td>
38+
</tr>
39+
</table>
40+
</div>
41+
</div>
42+
</>
43+
)
44+
}
45+
46+
47+
// best practice to export a component is to use named export
48+
export {
49+
WindowTape
50+
}

src/tryityourself/Susanta/WindowTape.style.css

Whitespace-only changes.

0 commit comments

Comments
 (0)