Skip to content

Commit b1e7604

Browse files
committed
fix(dark-mode): set body background color for dark mode
1 parent 6d493bd commit b1e7604

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/pages/ChannelDetails.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ function ChannelDetails() {
1212
const { sidebarExtend } = useSelector((state) => state.category)
1313
const { channelDetails } = useSelector((state) => state.channel)
1414
const { channelVideos } = useSelector((state) => state.channel)
15+
const { darkMode } = useSelector((state) => state.darkMode)
1516
var aDay = 24 * 60 * 60 * 1000;
1617
console.log(channelDetails.snippet)
1718
useEffect(() => {
1819
dispatch(getChannelVideos(`search?channelId=${id}&part=snippet&order=date`))
1920
dispatch(getChannelDetails(`channels?part=snippet&id=${id}`))
2021
}, [id,dispatch])
22+
23+
useEffect(() => {
24+
document.body.style.backgroundColor = darkMode ? "#131417" : "#fff";
25+
}, [darkMode]);
2126
console.log(window.innerWidth)
2227
return (
2328
<>

src/pages/SearchFeed.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ function SearchFeed() {
88
const { id } = useParams()
99
const { searchResults } = useSelector((state) => state.search)
1010
const { sidebarExtend } = useSelector((state) => state.category)
11+
const { darkMode } = useSelector((state) => state.darkMode)
1112
const dispatch = useDispatch()
1213
const pageRoute = useNavigate()
1314
var aDay = 24 * 60 * 60 * 1000;
1415

1516
useEffect(() => {
1617
dispatch(searchById(`search?part=snippet&q=${id}`))
1718
}, [id,dispatch])
19+
20+
useEffect(() => {
21+
document.body.style.backgroundColor = darkMode ? "#131417" : "#fff";
22+
}, [darkMode]);
1823
return (
1924
<>
2025
<div className={`sm:hidden overlayEffect ${sidebarExtend ? "block" : "hidden"}`}></div>

src/pages/VideoDetails.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ function VideoDetails() {
5757
);
5858
}, [id, dispatch]);
5959

60+
useEffect(() => {
61+
document.body.style.backgroundColor = darkMode ? "#131417" : "#fff";
62+
}, [darkMode]);
6063
return (
6164
<>
6265
<div

0 commit comments

Comments
 (0)