Skip to content

Commit c67b414

Browse files
committed
akash(random-background-color): Files and variables name updated.
1 parent 5d03156 commit c67b414

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

src/App.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import Counter from "./components/Hooks/useStateHook/Counter";
44
import Form from "./project/Form";
55
import ThemeToggler from "./project/ThemeToggler";
66
import HandlingForm from "./components/Hooks/useRefHook/HandlingForm";
7-
87
// TRY IT YOURSELF COMPONENTS
98
import FormDetails from "./tryityourself/Akash/FormDetails";
10-
import RandomBg from "./tryityourself/Akash/RandomBg";
9+
import RandomBackground from "./tryityourself/Akash/RandomBackground";
1110

1211
const App = () => {
13-
return <RandomBg />;
12+
return <RandomBackground />;
1413
};
1514

1615
export default App;

src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@import "tailwindcss";
22
@import "./components/Hooks/useRefHook/HandlingForm.style.css";
33
@import "./tryityourself/Akash/FormDetails.style.css";
4-
@import "./tryityourself/Akash/RandomBg.style.css";
4+
@import "./tryityourself/Akash/RandomBackground.style.css";
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import React, { useState, useEffect } from "react";
22

3-
const RandomBg = () => {
4-
const [rbg, setRbg] = useState();
3+
const RandomBackground = () => {
4+
const [randomSplash, setRandomSplash] = useState();
55

66
// FUNCTION FOR COLOR CHANGE (took help for the math.random() part)
7-
const ChangeBg = () => {
7+
const ChangeBackground = () => {
88
const randomColors = "#" + Math.random().toString(16).slice(2, 8);
9-
setRbg(randomColors);
9+
setRandomSplash(randomColors);
1010
};
1111

1212
// USE EFFECT TO CHANGE BACKGROUND AT INTERVALS (took help for implying setInterval inside useEffect )
1313
useEffect(() => {
14-
const interval = setInterval(ChangeBg, 1500);
14+
const interval = setInterval(ChangeBackground, 1500);
1515
}, []);
1616

1717
return (
18-
<div className="random-bg" style={{ backgroundColor: rbg }}>
18+
<div className="random-bg" style={{ backgroundColor: randomSplash }}>
1919
<div className="text">Random Background Color</div>
2020
</div>
2121
);
2222
};
23-
export default RandomBg;
23+
export default RandomBackground;

0 commit comments

Comments
 (0)