Skip to content

Commit

Permalink
bug: set background images for feature boxes in dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
YashNuhash committed Jan 23, 2024
1 parent c9385a5 commit 1dab835
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Binary file added src/assets/Home/dark-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion src/components/About/HomeAbout.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
import React from "react";
import React, { useEffect } from "react";

import idea from "../../assets/Home/creative-writing.png";
import component from "../../assets/Home/abstract.png";
import project from "../../assets/Home/blueprint.png";
import collaborate from "../../assets/Home/collaborate.png";
import darkBackground from "../../assets/Home/dark-background.png";

import { useTheme } from "../../context/ThemeContext";
import "./homeabout.css";

const HomeAbout = () => {
const { isDarkMode } = useTheme();

useEffect(() => {
const aboutBox = document.querySelectorAll(".about-box");

aboutBox.forEach((box) => {
if (isDarkMode) {
box.style.backgroundImage = `url(${darkBackground})`;
box.style.backgroundSize = "cover";
} else {
box.style.backgroundImage = "none";
}
});
}, [isDarkMode]);

return (
<section className="about-section">
<div className="about-container">
Expand Down
1 change: 0 additions & 1 deletion src/components/About/homeabout.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
0 6px 6px -1px rgba(8, 11, 14, 0.1);
border: 1px solid #f7f8f9;
margin: 10px;
background-color: #fff;
justify-content: center;
}

Expand Down

0 comments on commit 1dab835

Please sign in to comment.