Skip to content

Commit 40710b8

Browse files
committed
Merge branch 'main' of https://github.com/snippet-labs/REACTLAB into susanta/tiy-widnow-tape
2 parents a3f197f + b3c3ee8 commit 40710b8

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

src/App.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import DisplayList from "./components/Hooks/useCallback/DisplayList";
99
// TRY IT YOURSELF COMPONENTS
1010
import FormDetails from "./tryityourself/Akash/FormDetails";
1111
import RandomBackground from "./tryityourself/Akash/RandomBackground";
12+
import WindowTape from "./tryityourself/Akash/WindowTape";
1213

1314
// PROJECTS
1415
import StopWatch from "./project/StopWatch/StopWatch";
1516

1617
const App = () => {
17-
18-
return <DisplayList />;
19-
18+
return <WindowTape />;
2019
};
2120

2221
export default App;

src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
@import "./tryityourself/Akash/FormDetails.style.css";
44
@import "./tryityourself/Akash/RandomBackground.style.css";
55
@import "./project/StopWatch/StopWatch.style.css";
6+
@import "./tryityourself/Akash/WindowTape.style.css";
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React, { useState, useEffect } from "react";
2+
3+
const WindowTape = () => {
4+
const [height, setHeight] = useState(window.innerHeight);
5+
const [width, setWidth] = useState(window.innerWidth);
6+
7+
useEffect(() => {
8+
const handleHeight = () => setHeight(window.innerHeight);
9+
window.addEventListener("resize", handleHeight);
10+
const handleWidth = () => setWidth(window.innerWidth);
11+
window.addEventListener("resize", handleWidth);
12+
}, []);
13+
14+
return (
15+
<div className="Background">
16+
<div className="ScreenSize">
17+
{width} x {height}
18+
</div>
19+
</div>
20+
);
21+
};
22+
23+
export default WindowTape ;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.ScreenSize {
2+
@apply w-[500px] h-[100px] flex justify-center items-center p-2 text-3xl font-semibold text-white border-[2.5px] border-white rounded-md bg-gray-950 shadow-xl shadow-black;
3+
}
4+
5+
.Background {
6+
@apply h-screen flex justify-center items-center bg-orange-700;
7+
}

0 commit comments

Comments
 (0)