File tree 3 files changed +54
-1
lines changed
src/tryityourself/Susanta
3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,7 @@ npm-shrinkwrap.json
29
29
30
30
# bun lockfiles
31
31
bun.lockb
32
- bun.lock
32
+ bun.lock
33
+
34
+ # pnpm lockfiles
35
+ pnpm-lock.yaml
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments