Skip to content

Commit ad21648

Browse files
feat: optimize home hero image
1 parent e97011b commit ad21648

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/page.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import InfoBox from "@/components/InfoBox";
2+
import ExportedImage from "next-image-export-optimizer";
23

34
export default function Home() {
45
return (
56
<>
67
<div className="home-hero">
8+
<ExportedImage
9+
className="home-hero-image"
10+
src="/home-hero.jpg"
11+
alt="Hero image"
12+
fill={true}
13+
/>
714
<h1>Welcome to my website!</h1>
815
<div className="subtitle">Recipes, projects & more</div>
916
</div>

styles/pages/_home.scss

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,26 @@
22
@use "sass:map";
33

44
.home-hero {
5-
background-image: url(/home-hero.jpg);
65
background-color: rgba(0, 0, 0, 0.5);
76
background-blend-mode: overlay;
87
background-size: cover;
98
background-position: center;
109
padding: 0.5em;
1110
height: 90vh;
1211

12+
position: relative;
13+
1314
display: flex;
1415
flex-direction: column;
1516
justify-content: center;
1617
align-items: center;
1718

19+
.home-hero-image {
20+
object-fit: cover;
21+
pointer-events: none;
22+
z-index: -1;
23+
}
24+
1825
h1 {
1926
font-family: $font-black;
2027
font-size: 3rem;

0 commit comments

Comments
 (0)