ui(header): tweak header background, and single title to be less awkward

This commit is contained in:
Jean-Philippe Sirois
2020-11-12 01:33:23 -05:00
parent 1268a6fd99
commit 262e8b7fe6
7 changed files with 81 additions and 60 deletions
-4
View File
@@ -7,10 +7,6 @@ export const ContainerWrapper = styled.div`
padding: 0px var(--padding); padding: 0px var(--padding);
margin: 0 auto; margin: 0 auto;
@media screen and (max-width: 1200px) {
width: auto;
}
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
--padding: 32px; --padding: 32px;
} }
+32 -17
View File
@@ -11,30 +11,45 @@ interface IHeaderBareboneProps {
className?: string className?: string
} }
interface IBoxedTitleProps {
above?: React.ReactNode
content?: React.ReactNode
}
const BoxedTitle: React.FC<IBoxedTitleProps> = (props) => {
return (
<SC.Box>
{props.above}
<SC.Title
className={cx({
"has-content-above": props.above,
"has-content-below": props.content,
})}
>
{props.children}
</SC.Title>
{props.content}
</SC.Box>
)
}
export const HeaderBarebone: React.FC<IHeaderBareboneProps> = (props) => { export const HeaderBarebone: React.FC<IHeaderBareboneProps> = (props) => {
const isBoxed = props.above || props.content
return ( return (
<SC.HeaderWrapper className={props.className}> <SC.HeaderWrapper className={props.className}>
<SC.BackgroundWrapper> <SC.Background />
<SC.StyledWavesBottom />
<SC.StyledWavesTop />
<SC.StyledCircles />
</SC.BackgroundWrapper>
<Container> <Container>
<SC.Box> {isBoxed && (
{props.above} <BoxedTitle above={props.above} content={props.content}>
<SC.Title
className={cx({
"has-content-above": props.above,
"has-content-below": props.content,
})}
>
{props.title} {props.title}
</SC.Title> </BoxedTitle>
)}
{props.content} {!isBoxed && <SC.SingleTitle>{props.title}</SC.SingleTitle>}
</SC.Box>
</Container> </Container>
</SC.HeaderWrapper> </SC.HeaderWrapper>
) )
+49 -39
View File
@@ -1,15 +1,19 @@
import { transparentize, darken } from "polished" import { transparentize } from "polished"
import styled from "styled-components" import styled, { css } from "styled-components"
import { fontFamily } from "../../design/typography" import { fontFamily } from "../../design/typography"
import { WavesTop, WavesBottom } from "../Waves" import Header2560 from "../../images/header-2560x1440.png"
import Circles from "../../images/circles" import Header1920 from "../../images/header-1920x1080.png"
import Header1440 from "../../images/header-1440x900.png"
import HeaderMobile from "../../images/header-mobile-375x300.png"
const height = 250 const spaceAbove = 67
const height = 300 - spaceAbove
export const HeaderWrapper = styled.div` export const HeaderWrapper = styled.div`
display: flex;
width: 100%; width: 100%;
height: ${height}px; height: ${height}px;
padding-top: 67px; padding-top: ${spaceAbove}px;
position: relative; position: relative;
&.shifted { &.shifted {
@@ -30,51 +34,34 @@ export const HeaderWrapper = styled.div`
} }
` `
export const BackgroundWrapper = styled.div` export const Background = styled.div`
height: ${height}px;
padding-top: 67px;
overflow: hidden;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: cover;
@media screen and (max-width: 767px) { // 2560x1400 screens
height: calc(100% - 67px); @media screen and (min-width: 2500px) {
background: ${(props) => darken(0.2, props.theme.main.background)}; background-image: url("${Header2560}");
} }
`
export const StyledCircles = styled(Circles)` // 1920x1080 screens
position: absolute; @media screen and (min-width: 1800px) and (max-width: 2499px) {
top: 50%; background-image: url("${Header1920}");
margin-top: -200px;
@media screen and (max-width: 768px) {
margin-top: -145px;
margin-left: -20px;
margin-right: -20px;
} }
`
export const StyledWavesTop = styled(WavesTop)` // 1440x900 screens
opacity: ${(props) => (props.theme.name === "dark" ? 0.8 : 0.2)}; @media screen and (min-width: 768px) and (max-width: 1799px) {
top: -10%; background-image: url("${Header1440}");
transform: scaleX(-1);
@media screen and (max-width: 767px) {
top: 0;
} }
`
export const StyledWavesBottom = styled(WavesBottom)`
opacity: ${(props) => (props.theme.name === "dark" ? 0.8 : 0.2)};
bottom: -30%;
transform: scaleX(-1);
// mobile screens
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
bottom: 0; background-image: url("${HeaderMobile}");
} }
` `
@@ -112,13 +99,17 @@ export const Box = styled.div`
} }
` `
export const Title = styled.h1` const title = css`
font-family: ${fontFamily.header}; font-family: ${fontFamily.header};
font-size: 34px; font-size: 34px;
line-height: 41px; line-height: 41px;
letter-spacing: -1.75px; letter-spacing: -1.75px;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
`
export const Title = styled.h1`
${title};
&.has-content-above { &.has-content-above {
margin-top: 8px; margin-top: 8px;
@@ -128,3 +119,22 @@ export const Title = styled.h1`
margin-bottom: 8px; margin-bottom: 8px;
} }
` `
export const SingleTitle = styled(Title)`
${title};
color: #fff;
position: absolute;
bottom: 100px;
text-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
&::after {
position: absolute;
content: "";
left: 0;
top: 100%;
margin-top: 8px;
width: 100px;
height: 5px;
background: #fff;
}
`
Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB