So I want to be able to directly edit the Headers properties on different pages. I want to dynamically change the background image, title and subtitle. I have tried to change the background image already, but to no avail. I was wondering if someone could point me into the right direction on how to change the background, as well as the title and subtitle.
This is the Home Screen ReactJS
import Card from "../components/Card";
import Footer from "../components/Footer";
import Header from "../components/Header";
import Slider from "../components/ImageSlider/Slider";
import "./HomeScreen.css";
const HomeScreen = () => {
return (
<container className="container">
<Header style="background-image: url(https://images.pexels.com/photos/1509534/pexels-photo-1509534.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)" />
<div className="homescreen">
<h2 className="homescreen__title">Latest Artwork</h2>
<div className="homescreen__paintings">
<Card />
<Card />
<Card />
<Card />
</div>
<div className="homescreen__slider">
<div className="featured__products">Featured Products</div>
<Slider />
</div>
</div>
<Footer />
</container>
);
};
export default HomeScreen;
This is the HomeScreen CSS:
.container {
width: 100%;
max-width: 1440px;
}
.homescreen {
max-width: 1440px;
margin: auto;
padding: 0 1.5rem;
}
.homescreen__title {
display: flex;
justify-content: center;
font-size: 1.5rem;
color: #666;
margin-top: 1rem;
padding: 40px 0px;
}
.homescreen__paintings {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 1rem;
}
.homescreen__slider {
padding-top: 60px;
}
.featured__products {
display: flex;
justify-content: center;
position: relative;
color: #666;
font-size: 26px;
font-weight: normal;
font-family: "Kelly Slab", cursive;
padding-bottom: 4rem;
}
@media (max-width: 1232px) {
.homescreen__paintings {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 950px) {
.homescreen__paintings {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 630px) {
.homescreen__paintings {
grid-template-columns: 1fr;
}
}
This is the Header ReactJS:
import "./Header.css";
const Header = () => {
return (
<div className="header">
<div className="header__title">MERN Art</div>
<div className="header__subtitle">Acrylic Paintings Coated In Resin</div>
</div>
);
};
export default Header;
This is the Header CSS:
.header {
height: 300px;
padding-top: 4rem;
min-height: 3rem;
color: #fff;
background-image: url(https://images.pexels.com/photos/2179483/pexels-photo-2179483.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260);
background-size: cover;
background-position: 50% 35%;
background-attachment: fixed;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.header__title {
padding: 1rem 1rem;
font-size: 1.6rem;
}
.header__subtitle {
padding: 1rem 1rem;
font-size: 1.3rem;
}
What am I doing incorrect here? How would I dynamically change the title and subtitle too? Thank you in advance, I am looking forward to hearing some possible solutions!