Skip to content

Commit

Permalink
Refactor component props to pass isDarkMode
Browse files Browse the repository at this point in the history
  • Loading branch information
preston176 committed Feb 21, 2024
1 parent 3b4bd5a commit ec49c8c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/Components/Hero/Hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import React, { useContext } from 'react'
import ImageSlider from '../ImageSlider/ImageSlider'
import defaultImage from '../../assets/defaultImage.jpg'
import { Link } from 'react-router-dom'
import { ThemeContext } from '@emotion/react'

const Hero = () => {
const { isDarkMode } = useContext(ThemeContext);
const Hero = ({ isDarkMode }) => {


const ThemeStyles = {
Expand Down
6 changes: 2 additions & 4 deletions src/Components/Mid/Mid.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import BoltIcon from '@mui/icons-material/Bolt';
import PsychologyIcon from '@mui/icons-material/Psychology';
import MonetizationOnIcon from '@mui/icons-material/MonetizationOn';
import { ThemeContext } from '@emotion/react';
import { useContext } from 'react';

const Mid = () => {
const { isDarkMode } = useContext(ThemeContext);
const Mid = ({ isDarkMode }) => {



const ThemeStyles = {
Expand Down
3 changes: 1 addition & 2 deletions src/Components/Testimonial/Testimonial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const ThemeStyles = {
light: 'bg-[#858585] shadow-gray-700 bg-opacity-10'
}

const Testimonial = () => {
const { isDarkMode } = useContext(ThemeContext);
const Testimonial = ({ isDarkMode }) => {
return (
<section className={`py-12 bg-none sm:py-16 lg:py-20`}>
<div className="px-4 mx-auto max-w-7xl sm:px-6 lg:px-8">
Expand Down
10 changes: 6 additions & 4 deletions src/Pages/HomePage.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React from 'react'
import React, { useContext } from 'react'
import Hero from '../Components/Hero/Hero'
import Mid from '../Components/Mid/Mid'
import Testimonial from '../Components/Testimonial/Testimonial'
import { ThemeContext } from '@emotion/react'

const HomePage = () => {
const { isDarkMode } = useContext(ThemeContext);
return (

<>
<Hero />
<Mid />
<Testimonial />
<Hero isDarkMode={isDarkMode} />
<Mid isDarkMode={isDarkMode} />
<Testimonial isDarkMode={isDarkMode} />
</>

)
Expand Down

0 comments on commit ec49c8c

Please sign in to comment.