Skip to content

Commit 7ccbba3

Browse files
committed
Migrate hero layout from styled-components to SCSS module
1 parent 7bd2d00 commit 7ccbba3

3 files changed

Lines changed: 77 additions & 83 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@use '@/styles/index' as *;
2+
3+
.header {
4+
display: flex;
5+
flex-direction: column;
6+
align-items: center;
7+
position: relative;
8+
9+
@include desktop {
10+
height: 100vh;
11+
max-height: 56.25rem;
12+
}
13+
}
14+
15+
.headerContent {
16+
z-index: 10;
17+
color: var(--color-white);
18+
padding-top: 9%;
19+
}
20+
21+
.headerContentUpper {
22+
max-width: 41rem;
23+
24+
span {
25+
color: var(--color-primary-accent);
26+
font-style: italic;
27+
font-weight: bold;
28+
line-height: 3.5rem;
29+
30+
@include desktop {
31+
font-size: 4.5rem;
32+
line-height: 5rem;
33+
}
34+
}
35+
}
36+
37+
.headerContentBottom {
38+
max-width: 19rem;
39+
padding-bottom: 5rem;
40+
41+
@include desktop {
42+
padding-bottom: 0;
43+
44+
p {
45+
font-size: 1.5rem;
46+
}
47+
}
48+
}
49+
50+
.imageBg {
51+
object-fit: cover;
52+
object-position: center;
53+
}
54+
55+
.title {
56+
color: var(--color-primary-accent);
57+
}

components/layout/Hero/index.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useState } from 'react';
2+
import Image from 'next/image';
23
import Nav from '@/components/layout/Nav';
3-
import S from './styles';
4+
import Container from '@/components/containers/Container';
5+
import styles from './Hero.module.scss';
46

57
export default function Hero({
68
title,
@@ -20,20 +22,26 @@ export default function Hero({
2022
setTimeout(handleTitleIndex, 1550);
2123

2224
return (
23-
<S.Header>
25+
<div className={styles.header}>
2426
<Nav />
25-
<S.ImageBg src={imgBg} alt={imgAlt} fill priority />
26-
<S.HeaderContent>
27-
<S.HeaderContentUpper>
28-
<S.Title $hasAccent={hasAccent}>
27+
<Image
28+
className={styles.imageBg}
29+
src={imgBg}
30+
alt={imgAlt}
31+
fill
32+
priority
33+
/>
34+
<Container className={styles.headerContent}>
35+
<div className={styles.headerContentUpper}>
36+
<h1 className={hasAccent ? styles.title : null}>
2937
{title}
3038
{dynamicTitles && <span> {dynamicTitles[titleIndex]}</span>}
31-
</S.Title>
32-
</S.HeaderContentUpper>
33-
<S.HeaderContentBottom>
39+
</h1>
40+
</div>
41+
<div className={styles.headerContentBottom}>
3442
<p>{content}</p>
35-
</S.HeaderContentBottom>
36-
</S.HeaderContent>
37-
</S.Header>
43+
</div>
44+
</Container>
45+
</div>
3846
);
3947
}

components/layout/Hero/styles.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)