728x90

import React from "react";
const HomePage = () => {
return (
<div>
<HeroSection />
{/* ์ํ๋ค */}
{/* ํ์ด๋ก ์น์
*/}
</div>
);
};
export default HomePage;
HeroSection.jsx , css์์ฑ

HeroSection.jsx
import "./HeroSection.css";
import iphone from "../../assets/iphone-14-pro.webp";
const HeroSection = () => {
return (
<section className="hero_section">
<div className="align_center">
<h2 className="hero_title">์์ดํฐ 14 ๊ตฌ๋งคํ์ธ์</h2>
<p className="hero_subtitle">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia,
quibusdam.
</p>
<a href="#" className="hero_link">
๋ฐ๋ก๊ตฌ๋งค
</a>
</div>
<div className="align_center">
<img src={iphone} alt="" className="hero_image" />
</div>
</section>
);
};
export default HeroSection;
App.jsx ์ HomePage์ปดํฌ๋ํธ๋ฅผ ์ ์ฉํ๋ค.
import "./App.css";
import HomePage from "./components/Home/HomePage";
import Navbar from "./components/Navbar/Navbar";
function App() {
return (
<div className="app">
<nav>
<Navbar />
</nav>
<main>
<HomePage />
</main>
</div>
);
}
export default App;
HeroSection.css
.hero_section {
display: grid;
grid-template-columns: 1fr 1fr;
height: 550px;
padding: 0 60px;
background-color: #000;
color: #fff;
}
.hero_section > div {
justify-content: center;
flex-direction: column;
text-align: center;
}
.hero_title {
font-size: 45px;
font-weight: 700;
margin-bottom: 15px;
}
.hero_subtitle {
font-size: 24px;
margin-bottom: 32px;
width: 70%;
}
.hero_link {
padding: 16px 32px;
text-transform: uppercase;
letter-spacing: 1.5px;
font-weight: 700;
border: 2px solid #fff;
border-radius: 32px;
background-color: #fff;
color: #000;
transition: all 0.3s ease-in-out;
}
.hero_link:hover {
background-color: transparent;
color: #fff;
}
.hero_image {
height: 500px;
transition: all 0.3s ease-in-out;
}
.hero_image:hover {
transform: scale(1.05);
}

๊ทธ๋ฆฌ๊ณ HeroSection ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฌ์ฉ ํ๊ธฐ์ํด์ props๋ก ๋ฐ์์ ์ฌ์ฉ ํ ์ ์๊ฒ๋ ์ฝ๋ ์์ ์ํ๋ค.
HeroSection.jsx
import "./HeroSection.css";
const HeroSection = ({ title, subtitle, link, image }) => {
return (
<section className="hero_section">
<div className="align_center">
<h2 className="hero_title">{title}</h2>
<p className="hero_subtitle">{subtitle}</p>
<a href={link} className="hero_link">
๋ฐ๋ก๊ตฌ๋งค
</a>
</div>
<div className="align_center">
<img src={image} alt="" className="hero_image" />
</div>
</section>
);
};
export default HeroSection;
HomePage.jsx
import HeroSection from "./HeroSection";
import iphone from "../../assets/iphone-14-pro.webp";
import mac from "../../assets/mac-system-cut.jfif";
const HomePage = () => {
return (
<div>
<HeroSection
title="์์ดํฐ 14 ํ๋ก ๊ทธ ์ด์"
subtitle="Experience the power of the latest iPhone 14 with our most Pro camera ever."
link="/"
image={iphone}
/>
{/* ์ํ๋ค */}
<HeroSection
title="๊ถ๊ทน์ ์ฅ๋น๋ฅผ ์ธํ
ํ์ธ์"
subtitle="You can add Studio Display and colour-matched Magic accessories to your bag after configure your Mac mini."
link="/"
image={mac}
/>
</div>
);
};
export default HomePage;

๋ ๊ฐ์ ์น์ ์ด ๋์จ๋ค
'FRONTEND > React' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [myCart] ์ํํ์ด์ง ์์ฑ (์ฌ์ด๋ ๋ฐ/ ์ํ ๋ชฉ๋ก) (2) | 2023.12.19 |
|---|---|
| [myCart] FeaturedProducts ์ปดํฌ๋ํธ ๋ฐ ProductCard ์ปดํฌ๋ํธ ์ฌ์ฌ์ฉ (0) | 2023.12.19 |
| [myCart] Navbar ์ปดํฌ๋ํธ ์์ฑ ๋ฐ ์ ์ฉ /Navbar Link ์ปดํฌ๋ํธ๋ก ๊ด๋ฆฌ (2) | 2023.12.19 |
| [myCart] ํ๋ก์ ํธ ์ธํ (VITE) (0) | 2023.12.19 |
| [React-BookStore] ํ๋ ์ ํ ์ด์ ๋ง๋ค๊ธฐ (0) | 2023.12.17 |