Skip to content

Commit

Permalink
Merge pull request #28 from Scout-NU/develop-header-#26
Browse files Browse the repository at this point in the history
Develop header #26
  • Loading branch information
samgildea authored Apr 6, 2021
2 parents e51f26e + f7818f1 commit b28855d
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 6 deletions.
8 changes: 8 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,13 @@ module.exports = {
typePathsFilenamePrefix: "prismic-typepaths---powerhouse-site",
},
},
{
resolve: "gatsby-plugin-react-svg",
options: {
rule: {
include: /vectors/ // See below to configure properly
}
}
}
],
}
80 changes: 80 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"gatsby": "^2.26.1",
"gatsby-plugin-exclude": "^1.0.2",
"gatsby-plugin-netlify-headers": "^1.0.1",
"gatsby-plugin-react-svg": "^3.0.0",
"gatsby-plugin-sass": "^4.0.2",
"gatsby-source-prismic": "^3.3.3",
"node-sass": "^5.0.0",
Expand Down
59 changes: 59 additions & 0 deletions src/components/header/header-styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import styled from "styled-components"
import dimensions from "../../style/dimensions"
import colors from "../../style/colors"

export const NavContainer = styled.div`
background-color: ${colors.gray_image};
padding-bottom: 32px;
&.colorChange {
background-color: ${colors.gray_CTA};
}
position: fixed;
width: 100%;
transition: 0.5s all ease;
`

export const Logo = styled.div`
font-weight: bold;
font-size: 24px;
padding-top: 32px;
padding-left: 80px;
@media (max-width: ${dimensions.maxwidthTablet}px) {
text-align: center;
font-size: 20px;
padding-top: 24px;
padding-left: 0px;
}
`

export const NavLinks = styled.div`
position: absolute;
right: 80px;
top: 40px;
display: flex;
@media (max-width: ${dimensions.maxwidthTablet}px) {
display: none;
}
`

export const NavLink = styled.div`
font-weight: bold;
padding-left: 100px;
text-decoration: none;
color: ${colors.black900};
`

export const MobileIcon = styled.div`
@media (min-width: ${dimensions.maxwidthTablet}px) {
display: none;
}
@media (max-width: ${dimensions.maxwidthTablet}px) {
left: 24px;
top: 32px;
position: absolute;
}
`
50 changes: 50 additions & 0 deletions src/components/header/header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { useState } from "react"
import Hamburger from "../../vectors/hamburger.svg"
import {
NavContainer,
Logo,
MobileIcon,
NavLinks,
NavLink,
} from "./header-styles"

import { NavText } from "../../style/type-styles"

export const Header = () => {
const [open, setOpen] = useState(false)
const [colorChange, setColorchange] = useState(false)
const changeNavbarColor = () => {
if (typeof window !== "undefined" && window.scrollY >= 80) {
setColorchange(true)
} else {
setColorchange(false)
}
}
typeof window !== "undefined" &&
window.addEventListener("scroll", changeNavbarColor)

return (
<NavContainer className={colorChange ? "navbar colorChange" : "navbar"}>
<Logo>PowerHouse</Logo>

<MobileIcon onClick={() => setOpen(!open)} className={open ? "open" : ""}>
<Hamburger />
</MobileIcon>
<NavLinks>
<NavLink href="/about">
<NavText>ABOUT</NavText>
</NavLink>
<NavLink href="/process">
<NavText>PROCESS</NavText>
</NavLink>
<NavLink href="/products">
<NavText>PRODUCTS</NavText>
</NavLink>
<NavLink href="/solutions">
<NavText>SOLUTIONS</NavText>
</NavLink>
</NavLinks>
</NavContainer>
)
}
export default Header
9 changes: 4 additions & 5 deletions src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import "../style/global.scss"
import dimensions from "../style/dimensions"
import { layoutPaddingDesktop, layoutPaddingMobile } from "../style/variables"
import Footer from "../components/footer/footer"
import Header from "../components/header/header"

const LayoutContainer = styled.div`
`
const LayoutContainer = styled.div``
const LayoutBody = styled.div`
@media (min-width: ${dimensions.maxwidthTablet}px) {
padding: 0 ${layoutPaddingDesktop} ${layoutPaddingDesktop};s
Expand All @@ -22,11 +21,11 @@ const LayoutBody = styled.div`
const Layout = ({ children }) => {
return (
<LayoutContainer>
<Header />
<LayoutBody>{children}</LayoutBody>

<Footer />
</LayoutContainer>
)
}

export default Layout
export default Layout
10 changes: 9 additions & 1 deletion src/style/type-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const minSize = {
h2: 30,
h3: 20,
p: 16,
nav: 16,
}

const devices = {
Expand All @@ -20,6 +21,7 @@ const fontSizes = {
h2: `calc(${minSize.h2}px + (48 - ${minSize.h2}) * ((100vw - ${devices.mobile}px) / (${devices.desktop} - ${devices.mobile})))`,
h3: `calc(${minSize.h3}px + (32 - ${minSize.h3}) * ((100vw - ${devices.mobile}px) / (${devices.desktop} - ${devices.mobile})))`,
p: `calc(${minSize.p}px + (24 - ${minSize.p}) * ((100vw - ${devices.mobile}px) / (${devices.desktop} - ${devices.mobile})))`,
NavText: `calc(${minSize.nav}px + (24 - ${minSize.nav}) * ((100vw - ${devices.mobile}px) / (${devices.desktop} - ${devices.mobile})))`,
}

const H1 = styled.h1`
Expand All @@ -41,4 +43,10 @@ const P = styled.p`
font-size: ${fontSizes.p};
`

export { H1, H2, H3, P }
const NavText = styled.a`
font-size: ${fontSizes.nav};
`

export { H1, H2, H3, P, NavText }
5 changes: 5 additions & 0 deletions src/vectors/hamburger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b28855d

Please sign in to comment.