Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions src/components/Banners/BannerTop.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import React from "react"
import PropTypes from "prop-types"
import { getImage, GatsbyImage } from "gatsby-plugin-image"

import { getImage } from "gatsby-plugin-image"
import { BgImage } from "gbimage-bridge"
import "./BannerTop.scss"

const BannerTop = ({ banner }) => {
const { image, imagePage, title, variant = "" } = banner
const imageBanner = getImage(image?.localFile) || getImage(imagePage?.localFile)

const imageBanner =
getImage(image?.localFile) || getImage(imagePage?.localFile)

return (
<div className={`BannerTop ${variant}`}>
<h1 className={`BannerTop__title ${variant && "background container"}`}>
{title}
</h1>
{imageBanner && (
<GatsbyImage
{imageBanner ? (
<BgImage
image={imageBanner}
alt={title}
className="BannerTop__bgImage"
loading="eager"
fetchpriority="high"
/>
>
<div className="BannerTop__titleContainer">
<h1 className={`BannerTop__title ${variant && "background container"}`}>
{title}
</h1>
</div>
</BgImage>
) : (
<div className="BannerTop__titleContainer">
<h1 className={`BannerTop__title ${variant && "background container"}`}>
{title}
</h1>
</div>
)}
</div>
)
Expand Down
39 changes: 23 additions & 16 deletions src/components/Banners/BannerTop.scss
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
@import "../../styles/global.scss";

.BannerTop {
position: relative;

&__bgImage {
min-height: 40vh;
width: 100%;
object-fit: cover;
display: flex;
align-items: flex-end;
}

&__title {
&__titleContainer {
position: absolute;
bottom: 0;
width: 100%;
padding: 24px 8px;
background-color: rgba(36, 39, 42, 0.4);
padding: 24px 8px;
width: 100%;
}

&__title {
text-wrap: pretty;
color: $white;
font-weight: $max-bold;
margin-bottom: 0;
text-transform: uppercase;
z-index: 2;
font-family: "Plain", sans-serif;
font-weight: 900;
font-size: $large;

&:not(.background) {
text-transform: none;
font-size: $medium;
}
}

&.background &__title {
padding: 24px 8px;
&.background {
&__titleContainer {
padding: 24px 8px;
}
}
}

Expand All @@ -40,13 +42,18 @@
min-height: 55vh;
}

&__title {
&__titleContainer {
padding: 30px;
}

&__title:not(.background) {
font-size: $extra-large;
}

&.background &__title {
padding: 30px 0;
&.background {
&__titleContainer {
padding: 30px 0;
}
}
}
}
}