Skip to content

Commit

Permalink
Update page body layout, hero responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
LanesGood committed Jul 26, 2024
1 parent 02d8ca0 commit f749957
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 34 deletions.
4 changes: 1 addition & 3 deletions src/components/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ const Headline = styled.p`
}
`

const Footer = ({ shortname, isMediumDown }) => {
console.log(isMediumDown)
const Footer = ({ shortname }) => {
return (
<PageFooter data-cy="page-footer">
<PageFooterInner>
Expand Down Expand Up @@ -233,7 +232,6 @@ const Footer = ({ shortname, isMediumDown }) => {

Footer.propTypes = {
shortname: PropTypes.string.isRequired,
isMediumDown: PropTypes.bool,
}

export default Footer
40 changes: 24 additions & 16 deletions src/components/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styled from "styled-components"
import { StaticImage } from "gatsby-plugin-image"

import { NEGATIVE, POSITIVE } from "../utils/constants"
import { colors, layout } from "../theme"
import { colors, layout, breakpoints } from "../theme"
import DateList from "./date-list-hover"
import { ArrowIcon } from "../icons"
import { TypeAhead } from "../components/typeahead-box"
Expand Down Expand Up @@ -75,7 +75,26 @@ const Container = styled.section`
}%, rgba(12,21,32, 0.0)${ratioInPercent + 20}%)`
: null};
`
const HeroContentWrapper = styled.div`
grid-area: 1 / 2 / 1 / 2;
display: grid;
grid-template-columns: ${({ textToImageRatio }) =>
textToImageRatio && `${textToImageRatio[0]}fr ${textToImageRatio[1]}fr`};
grid-template-areas:
"title image"
"extras image";
grid-gap: 0.5rem;
padding: 0 ${layout.smallPageMargin};
@media screen and (min-width: ${breakpoints["sm"]}) {
padding: 0 ${layout.pageMargin};
}
`
const HeroTitle = styled.h1`
@media screen and (max-width: ${breakpoints["sm"]}) {
font-size: 2.875rem;
}
`
export default function Hero({
backlink,
tagline,
Expand Down Expand Up @@ -117,19 +136,7 @@ export default function Hero({
backgroundImage={backgroundImage}
ratioInPercent={ratioInPercent}
>
<div
css={`
grid-area: 1 / 2 / 1 / 2;
display: grid;
grid-template-columns: ${textToImageRatio[0]}fr ${textToImageRatio[1]}fr;
grid-template-areas:
"title image"
"extras image";
grid-gap: 0.5rem;
padding: 0 ${layout.pageMargin};
`}
>
<HeroContentWrapper textToImageRatio={textToImageRatio}>
<div
css={`
align-self: end;
Expand Down Expand Up @@ -165,7 +172,7 @@ export default function Hero({
</p>
)}

<h1>{title}</h1>
<HeroTitle>{title}</HeroTitle>
</div>

<div
Expand All @@ -190,6 +197,7 @@ export default function Hero({
font-weight: bold;
padding: 1rem 5rem;
align-self: flex-start;
white-space: pre;
`}
data-cy="cta-link"
>
Expand All @@ -211,7 +219,7 @@ export default function Hero({
{image}
</div>
)}
</div>
</HeroContentWrapper>

{backgroundImage && (
<div
Expand Down
26 changes: 12 additions & 14 deletions src/components/layout/page-body.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import React from "react"
import styled from "styled-components"
import PropTypes from "prop-types"

import { layout } from "../../theme"
import { layout, breakpoints } from "../../theme"

const PageBodyStyles = styled.div`
width: 100%;
max-width: ${layout.maxWidth};
margin: 0 auto;
padding: 0 ${layout.smallPageMargin};
@media screen and (min-width: ${breakpoints["sm"]}) {
padding: 0 ${layout.pageMargin};
}
`
export default function PageBody({ children, id }) {
return (
<div
css={`
width: 100%;
max-width: ${layout.maxWidth};
margin: 0 auto;
padding: 0 ${layout.pageMargin};
`}
data-cy={`main-${id}`}
>
{children}
</div>
)
return <PageBodyStyles data-cy={`main-${id}`}>{children}</PageBodyStyles>
}

PageBody.propTypes = {
Expand Down
5 changes: 4 additions & 1 deletion src/components/typeahead-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export function TypeAhead() {
align-items: center;
cursor: pointer;
width: 100%;
min-width: 24rem;
min-width: 80vw;
@media screen and (min-width: 800px) {
min-width: 24rem;
}
`}
>
<input
Expand Down

0 comments on commit f749957

Please sign in to comment.