Skip to content

Commit 1d74d32

Browse files
Merge pull request #128 from bitlogic/SBIT-616-Corregir-componente-BannerTop
fix banner top
2 parents ed14445 + 79f2c96 commit 1d74d32

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

src/components/Banners/BannerTop.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
import React from "react"
22
import PropTypes from "prop-types"
3-
import { getImage, GatsbyImage } from "gatsby-plugin-image"
4-
3+
import { getImage } from "gatsby-plugin-image"
4+
import { BgImage } from "gbimage-bridge"
55
import "./BannerTop.scss"
66

77
const BannerTop = ({ banner }) => {
88
const { image, imagePage, title, variant = "" } = banner
9-
const imageBanner = getImage(image?.localFile) || getImage(imagePage?.localFile)
9+
10+
const imageBanner =
11+
getImage(image?.localFile) || getImage(imagePage?.localFile)
1012

1113
return (
1214
<div className={`BannerTop ${variant}`}>
13-
<h1 className={`BannerTop__title ${variant && "background container"}`}>
14-
{title}
15-
</h1>
16-
{imageBanner && (
17-
<GatsbyImage
15+
{imageBanner ? (
16+
<BgImage
1817
image={imageBanner}
19-
alt={title}
2018
className="BannerTop__bgImage"
2119
loading="eager"
2220
fetchpriority="high"
23-
/>
21+
>
22+
<div className="BannerTop__titleContainer">
23+
<h1 className={`BannerTop__title ${variant && "background container"}`}>
24+
{title}
25+
</h1>
26+
</div>
27+
</BgImage>
28+
) : (
29+
<div className="BannerTop__titleContainer">
30+
<h1 className={`BannerTop__title ${variant && "background container"}`}>
31+
{title}
32+
</h1>
33+
</div>
2434
)}
2535
</div>
2636
)
Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
@import "../../styles/global.scss";
22

33
.BannerTop {
4-
position: relative;
5-
64
&__bgImage {
75
min-height: 40vh;
86
width: 100%;
9-
object-fit: cover;
7+
display: flex;
8+
align-items: flex-end;
109
}
1110

12-
&__title {
11+
&__titleContainer {
1312
position: absolute;
1413
bottom: 0;
15-
width: 100%;
16-
padding: 24px 8px;
1714
background-color: rgba(36, 39, 42, 0.4);
15+
padding: 24px 8px;
16+
width: 100%;
17+
}
18+
19+
&__title {
20+
text-wrap: pretty;
1821
color: $white;
22+
font-weight: $max-bold;
1923
margin-bottom: 0;
2024
text-transform: uppercase;
21-
z-index: 2;
22-
font-family: "Plain", sans-serif;
23-
font-weight: 900;
24-
font-size: $large;
2525

2626
&:not(.background) {
2727
text-transform: none;
2828
font-size: $medium;
2929
}
3030
}
3131

32-
&.background &__title {
33-
padding: 24px 8px;
32+
&.background {
33+
&__titleContainer {
34+
padding: 24px 8px;
35+
}
3436
}
3537
}
3638

@@ -40,13 +42,18 @@
4042
min-height: 55vh;
4143
}
4244

43-
&__title {
45+
&__titleContainer {
4446
padding: 30px;
47+
}
48+
49+
&__title:not(.background) {
4550
font-size: $extra-large;
4651
}
4752

48-
&.background &__title {
49-
padding: 30px 0;
53+
&.background {
54+
&__titleContainer {
55+
padding: 30px 0;
56+
}
5057
}
5158
}
52-
}
59+
}

0 commit comments

Comments
 (0)