diff --git a/src/components/ArchivesSidebar/index.tsx b/src/components/ArchivesSidebar/index.tsx index 6a1bad7..efad0d7 100644 --- a/src/components/ArchivesSidebar/index.tsx +++ b/src/components/ArchivesSidebar/index.tsx @@ -2,7 +2,7 @@ import { graphql, useStaticQuery } from "gatsby" import React, { FC, HTMLAttributes } from "react" import { IAllArchivesQuery, IFileOrFolder } from "../../types" import { humanize } from "../../utils" -import { ColumnSidebar } from "../ColumnSidebar" +import { Sidebar } from "../Sidebar" import useBuildTree from "./../../hooks/useBuildTree" import * as SC from "./styles" @@ -31,5 +31,5 @@ export const ArchivesSidebar: FC> = props => { const tree = useBuildTree(archives, "/archives") const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title)) - return {sortedTree.map(plantTree)} + return {sortedTree.map(plantTree)} } diff --git a/src/components/ColumnHeader/index.tsx b/src/components/ColumnHeader/index.tsx deleted file mode 100644 index 9045c1f..0000000 --- a/src/components/ColumnHeader/index.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import React, { FC, Fragment } from "react" - -import ChevronUp from "../../icons/chevron-up.svg" -import { Breadcrumb } from "../Breadcrumb" -import { StackedAvatars } from "../StackedAvatars" -import * as SC from "./styles" - -interface IColumnHeaderProps { - relativePath: string - basePath: string - title: string - authors?: Array<{ - avatar: string - hash: string - name: string - }> - createdAt: string - timeToRead: number - recommendedReading?: string[] - externalResources?: string[] -} - -function ExtraLink({ - item, - external = false, -}: { - item: string - external?: boolean -}) { - const Inner = () => ( - - {item} - - ) - - if (external) { - return ( - - - - ) - } - - return ( - - - - ) -} - -export const ColumnHeader: FC = ({ - basePath, - relativePath, - title, - authors, - createdAt, - timeToRead, - recommendedReading, - externalResources, -}) => { - const date = new Date(createdAt) - const month = date.toLocaleString("default", { month: "long" }) - const day = date.getDate() - const year = date.getUTCFullYear() - const dateToHuman = `${month} ${day}, ${year}` - - return ( - - - - {title} - - - {authors && ( - - - - {authors.length} contributor{authors.length > 1 && "s"} - - {authors - .map(author => `${author.name}#${author.hash}`) - .join(", ")} - - - - )} - {dateToHuman && {dateToHuman}} - - {timeToRead} minute{timeToRead !== 1 && "s"} read time - - - - {recommendedReading && ( - - Recommended reading - {recommendedReading.map(item => { - return - })} - - )} - - {externalResources && ( - - External Resources - {externalResources.map(item => { - return - })} - - )} - - ) -} diff --git a/src/components/ColumnHeader/styles.tsx b/src/components/ColumnHeader/styles.tsx deleted file mode 100644 index a45018a..0000000 --- a/src/components/ColumnHeader/styles.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import { Link } from "gatsby" -import { darken, lighten } from "polished" -import styled, { css } from "styled-components" -import { fontFamily, modularScale } from "../../design/typography" - -export const ColumnHeaderWrapper = styled.div` - border-bottom: 1px solid #dbdbdb; - padding-bottom: 32px; - margin-bottom: 32px; -` - -export const Top = styled.div` - display: flex; - align-items: center; - - @media screen and (max-width: 767px) { - flex-direction: column; - align-items: flex-start; - } -` - -export const Title = styled.h1` - font-family: ${fontFamily.header}; - font-size: ${modularScale(6).fontSize}px; - line-height: ${modularScale(6).lineHeight}px; - letter-spacing: -1.75px; - margin-top: 0; -` - -export const Meta = styled.div` - display: flex; - align-items: center; - - & + &::before { - content: "•"; - margin: 0 8px; - } - - @media screen and (max-width: 767px) { - & + & { - margin-top: 8px; - } - - & + &::before { - display: none; - } - } -` - -const ExtraLinks = styled.div` - margin-top: 16px; -` - -export const RecommendedReading = styled(ExtraLinks)`` - -export const ExternalResources = styled(ExtraLinks)`` - -const extraLink = css` - display: flex; - align-items: center; - color: ${props => props.theme.main.link}; - margin-top: 4px; - margin-left: 20px; - cursor: pointer; - - &:hover { - color: ${props => - props.theme.name === "dark" - ? lighten(0.15, props.theme.main.link) - : darken(0.15, props.theme.main.link)}; - } - - svg { - width: 14px; - flex: 0 0 14px; - transform: rotate(90deg); - margin-right: 6px; - } - - svg path { - fill: ${props => props.theme.main.link}; - } -` - -export const ExtraLinkInternal = styled(Link)` - ${extraLink}; -` - -export const ExtraLinkExternal = styled.a` - ${extraLink}; -` - -export const ExtraLinkText = styled.div` - text-decoration: underline; -` - -export const Popover = styled.div` - display: none; - position: absolute; - top: 100%; - margin-top: 8px; - padding: 8px; - border-radius: 4px; - background: ${props => - props.theme.name === "dark" - ? lighten(0.1, props.theme.main.background) - : darken(0.1, props.theme.main.background)}; - - &::before { - position: absolute; - left: 16px; - bottom: 100%; - content: ""; - width: 0; - height: 0; - border-style: solid; - border-width: 0 3.5px 4px 3.5px; - border-color: transparent transparent - ${props => - props.theme.name === "dark" - ? lighten(0.1, props.theme.main.background) - : darken(0.1, props.theme.main.background)} - transparent; - } -` - -export const PopoverToggler = styled.div` - display: flex; - align-items: center; - position: relative; - - &:hover ${Popover} { - display: block; - } -` diff --git a/src/components/ColumnLink/index.tsx b/src/components/ColumnLink/index.tsx deleted file mode 100644 index b455298..0000000 --- a/src/components/ColumnLink/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React, { FC } from "react" -import * as SC from "./styles" - -interface IColumnLinkProps { - to: string -} - -export const ColumnLink: FC = ({ children, to }) => { - if (!to.match(/^(https?:\/\/)/)) { - return {children} - } - - return ( - - {children} - - ) -} diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 651a509..2e3a11c 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -1,96 +1,112 @@ -import { Link } from "gatsby" -import React, { FC, useLayoutEffect, useState } from "react" -import { DiscordButton } from "../DiscordButton" -import { Partner } from "../Partner" -import { WavesBottom, WavesTop } from "../Waves" +import React, { FC, Fragment } from "react" + +import ChevronUp from "../../icons/chevron-up.svg" +import { Breadcrumb } from "../Breadcrumb" +import { StackedAvatars } from "../StackedAvatars" import * as SC from "./styles" interface IHeaderProps { - isHome: boolean + relativePath: string + basePath: string + title: string + authors?: Array<{ + avatar: string + hash: string + name: string + }> + createdAt: string + timeToRead: number + recommendedReading?: string[] + externalResources?: string[] } -interface IMenuItemProps { - to: string -} +function ExtraLink({ + item, + external = false, +}: { + item: string + external?: boolean +}) { + const Inner = () => ( + + {item} + + ) + + if (external) { + return ( + + + + ) + } -const MenuItem: FC = ({ children, to }) => { return ( - - {children} - - + + + ) } -export const Header: FC = ({ isHome }) => { - // Hack to force Particle.js to rerender - const [noop, setNoop] = useState(0) - useLayoutEffect(() => { - setNoop(prevState => prevState + 1) - }, [isHome]) +export const Header: FC = ({ + basePath, + relativePath, + title, + authors, + createdAt, + timeToRead, + recommendedReading, + externalResources, +}) => { + const date = new Date(createdAt) + const month = date.toLocaleString("default", { month: "long" }) + const day = date.getDate() + const year = date.getUTCFullYear() + const dateToHuman = `${month} ${day}, ${year}` return ( - - - - - + + - - - - - - - The Programmer's Hangout - - - about - rules - faq - hotbot - resources - tech spotlights - - join us - {isHome && } - + {title} + + + {authors && ( + + + + {authors.length} contributor{authors.length > 1 && "s"} + + {authors + .map(author => `${author.name}#${author.hash}`) + .join(", ")} + + + + )} + {dateToHuman && {dateToHuman}} + + {timeToRead} minute{timeToRead !== 1 && "s"} read time + + + + {recommendedReading && ( + + Recommended reading + {recommendedReading.map(item => { + return + })} + + )} + + {externalResources && ( + + External Resources + {externalResources.map(item => { + return + })} + + )} ) } diff --git a/src/components/Header/styles.tsx b/src/components/Header/styles.tsx index 82c3073..3ed36fe 100644 --- a/src/components/Header/styles.tsx +++ b/src/components/Header/styles.tsx @@ -1,192 +1,135 @@ import { Link } from "gatsby" -import Particles from "react-particles-js" -import styled from "styled-components" -import TPHLogo from "../../images/tph-logo.svg" +import { darken, lighten } from "polished" +import styled, { css } from "styled-components" +import { fontFamily, modularScale } from "../../design/typography" -export const HeaderWrapper = styled.header` - display: flex; - justify-content: center; - align-items: center; - width: 100%; - position: relative; - min-height: auto; - background: #1f2a34; - - &.is-home { - min-height: 100vh; - overflow: hidden; - } +export const HeaderWrapper = styled.div` + border-bottom: 1px solid #dbdbdb; + padding-bottom: 32px; + margin-bottom: 32px; ` -export const TitleWrapper = styled.div` +export const Top = styled.div` display: flex; align-items: center; - margin-bottom: 22px; - .is-home & { + @media screen and (max-width: 767px) { flex-direction: column; align-items: flex-start; } ` export const Title = styled.h1` - margin: 0; - font-weight: 700; - font-size: 50px; - text-transform: uppercase; - line-height: 1; - color: #fff; - text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); - - .is-home & { - margin: 32px 0; - font-size: 88px; - - @media screen and (max-width: 991px) { - font-size: 58px; - } - - @media screen and (max-width: 767px) { - font-size: 32px; - } - } + font-family: ${fontFamily.header}; + font-size: ${modularScale(6).fontSize}px; + line-height: ${modularScale(6).lineHeight}px; + letter-spacing: -1.75px; + margin-top: 0; ` -export const FadedBottomWave = styled.div` - position: absolute; - transform: translateY(100%); - bottom: 0; - left: 0; - right: 0; - transition: opacity 0.5s, transform 0.5s; - opacity: 0; - pointer-events: none; - - svg { - position: static; - } - - .is-home & { - opacity: 1; - transform: translateY(0); - } - - .is-home & svg { - position: static; - } -` - -export const StyledParticles = styled(Particles)` - mask-image: -webkit-linear-gradient( - top, - rgba(0, 0, 0, 0) 5%, - rgba(0, 0, 0, 1) 25%, - rgba(0, 0, 0, 1) 75%, - rgba(0, 0, 0, 0) 95% - ); - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; -` - -export const InnerWrapper = styled.div` - width: 800px; - max-width: calc(100% - 64px); - padding: 32px; - position: relative; - display: flex; - align-items: flex-start; - flex-direction: column; -` - -export const Logo = styled(TPHLogo)` - width: 70px; - margin: 0 15px 0 0; - position: relative; - z-index: 3; - - .is-home & { - width: 98px; - margin-bottom: 0 0 10px 0; - } -` - -export const Menu = styled.nav` - display: flex; - justify-content: flex-start; - flex-wrap: wrap; -` - -export const MenuItemText = styled.div` - position: relative; - z-index: 5; -` - -/* underline bar, getting animated through hover */ -export const MenuItemLine = styled.div` - position: absolute; - z-index: 4; - height: 2px; - width: 100%; - margin-top: -3px; - bottom: 0; - background: #fff; - transition: all 0.3s; -` - -export const MenuItem = styled(Link)` +export const Meta = styled.div` display: flex; align-items: center; - font-size: 22px; - text-decoration: none; - color: #fff; - position: relative; - transition: color 0.3s; - margin: 10px 20px 5px 0; - font-family: "Oxygen Mono"; - &:hover { - color: #fff; + & + &::before { + content: "•"; + margin: 0 8px; } - &:hover ${MenuItemLine} { - padding: 8px; - height: 100%; - background: #dd66a1; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1), 0 5px 11px rgba(0, 0, 0, 0.25); - margin-left: -8px; - margin-bottom: -8px; - border-radius: 3px; - } - - &.disabled { - cursor: default; - pointer-events: none; - opacity: 0.7; - color: #fff !important; - } - - &.disabled ${MenuItemLine} { - bottom: 50%; - background: #fff !important; - } - - &.active { - font-weight: 700; - color: #dd66a1; - - ${MenuItemLine} { - background: #dd66a1; + @media screen and (max-width: 767px) { + & + & { + margin-top: 8px; } - &:hover { - color: #fff; - } - - &:hover ${MenuItemLine} { - background: #dd66a1; + & + &::before { + display: none; } } ` + +const ExtraLinks = styled.div` + margin-top: 16px; +` + +export const RecommendedReading = styled(ExtraLinks)`` + +export const ExternalResources = styled(ExtraLinks)`` + +const extraLink = css` + display: flex; + align-items: center; + color: ${props => props.theme.main.link}; + margin-top: 4px; + margin-left: 20px; + cursor: pointer; + + &:hover { + color: ${props => + props.theme.name === "dark" + ? lighten(0.15, props.theme.main.link) + : darken(0.15, props.theme.main.link)}; + } + + svg { + width: 14px; + flex: 0 0 14px; + transform: rotate(90deg); + margin-right: 6px; + } + + svg path { + fill: ${props => props.theme.main.link}; + } +` + +export const ExtraLinkInternal = styled(Link)` + ${extraLink}; +` + +export const ExtraLinkExternal = styled.a` + ${extraLink}; +` + +export const ExtraLinkText = styled.div` + text-decoration: underline; +` + +export const Popover = styled.div` + display: none; + position: absolute; + top: 100%; + margin-top: 8px; + padding: 8px; + border-radius: 4px; + background: ${props => + props.theme.name === "dark" + ? lighten(0.1, props.theme.main.background) + : darken(0.1, props.theme.main.background)}; + + &::before { + position: absolute; + left: 16px; + bottom: 100%; + content: ""; + width: 0; + height: 0; + border-style: solid; + border-width: 0 3.5px 4px 3.5px; + border-color: transparent transparent + ${props => + props.theme.name === "dark" + ? lighten(0.1, props.theme.main.background) + : darken(0.1, props.theme.main.background)} + transparent; + } +` + +export const PopoverToggler = styled.div` + display: flex; + align-items: center; + position: relative; + + &:hover ${Popover} { + display: block; + } +` diff --git a/src/components/Footer/index.tsx b/src/components/HomeFooter/index.tsx similarity index 82% rename from src/components/Footer/index.tsx rename to src/components/HomeFooter/index.tsx index 99f50ec..ad565eb 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/HomeFooter/index.tsx @@ -3,9 +3,9 @@ import packageJson from "../../../package.json" import { Container } from "../Container" import * as SC from "./styles" -export const Footer: FC = () => { +export const HomeFooter: FC = () => { return ( - +

© {new Date().getFullYear()}, Built with @@ -14,6 +14,6 @@ export const Footer: FC = () => { GitHub

-
+ ) } diff --git a/src/components/Footer/styles.tsx b/src/components/HomeFooter/styles.tsx similarity index 85% rename from src/components/Footer/styles.tsx rename to src/components/HomeFooter/styles.tsx index 4588dd3..4e582d2 100644 --- a/src/components/Footer/styles.tsx +++ b/src/components/HomeFooter/styles.tsx @@ -1,6 +1,6 @@ import styled from "styled-components" -export const FooterWrapper = styled.footer` +export const HomeFooterWrapper = styled.footer` & a { display: inline; color: #0090d8; diff --git a/src/components/HomeHeader/index.tsx b/src/components/HomeHeader/index.tsx new file mode 100644 index 0000000..ec33320 --- /dev/null +++ b/src/components/HomeHeader/index.tsx @@ -0,0 +1,96 @@ +import { Link } from "gatsby" +import React, { FC, useLayoutEffect, useState } from "react" +import { DiscordButton } from "../DiscordButton" +import { HomePartner } from "../HomePartner" +import { WavesBottom, WavesTop } from "../Waves" +import * as SC from "./styles" + +interface IHomeHeaderProps { + isHome: boolean +} + +interface IMenuItemProps { + to: string +} + +const MenuItem: FC = ({ children, to }) => { + return ( + + {children} + + + ) +} + +export const HomeHeader: FC = ({ isHome }) => { + // Hack to force Particle.js to rerender + const [noop, setNoop] = useState(0) + useLayoutEffect(() => { + setNoop(prevState => prevState + 1) + }, [isHome]) + + return ( + + + + + + + + + + + + + The Programmer's Hangout + + + about + rules + faq + hotbot + resources + tech spotlights + + join us + {isHome && } + + + ) +} diff --git a/src/components/HomeHeader/styles.tsx b/src/components/HomeHeader/styles.tsx new file mode 100644 index 0000000..4e02730 --- /dev/null +++ b/src/components/HomeHeader/styles.tsx @@ -0,0 +1,192 @@ +import { Link } from "gatsby" +import Particles from "react-particles-js" +import styled from "styled-components" +import TPHLogo from "../../images/tph-logo.svg" + +export const HomeHeaderWrapper = styled.header` + display: flex; + justify-content: center; + align-items: center; + width: 100%; + position: relative; + min-height: auto; + background: #1f2a34; + + &.is-home { + min-height: 100vh; + overflow: hidden; + } +` + +export const TitleWrapper = styled.div` + display: flex; + align-items: center; + margin-bottom: 22px; + + .is-home & { + flex-direction: column; + align-items: flex-start; + } +` + +export const Title = styled.h1` + margin: 0; + font-weight: 700; + font-size: 50px; + text-transform: uppercase; + line-height: 1; + color: #fff; + text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); + + .is-home & { + margin: 32px 0; + font-size: 88px; + + @media screen and (max-width: 991px) { + font-size: 58px; + } + + @media screen and (max-width: 767px) { + font-size: 32px; + } + } +` + +export const FadedBottomWave = styled.div` + position: absolute; + transform: translateY(100%); + bottom: 0; + left: 0; + right: 0; + transition: opacity 0.5s, transform 0.5s; + opacity: 0; + pointer-events: none; + + svg { + position: static; + } + + .is-home & { + opacity: 1; + transform: translateY(0); + } + + .is-home & svg { + position: static; + } +` + +export const StyledParticles = styled(Particles)` + mask-image: -webkit-linear-gradient( + top, + rgba(0, 0, 0, 0) 5%, + rgba(0, 0, 0, 1) 25%, + rgba(0, 0, 0, 1) 75%, + rgba(0, 0, 0, 0) 95% + ); + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +` + +export const InnerWrapper = styled.div` + width: 800px; + max-width: calc(100% - 64px); + padding: 32px; + position: relative; + display: flex; + align-items: flex-start; + flex-direction: column; +` + +export const Logo = styled(TPHLogo)` + width: 70px; + margin: 0 15px 0 0; + position: relative; + z-index: 3; + + .is-home & { + width: 98px; + margin-bottom: 0 0 10px 0; + } +` + +export const Menu = styled.nav` + display: flex; + justify-content: flex-start; + flex-wrap: wrap; +` + +export const MenuItemText = styled.div` + position: relative; + z-index: 5; +` + +/* underline bar, getting animated through hover */ +export const MenuItemLine = styled.div` + position: absolute; + z-index: 4; + height: 2px; + width: 100%; + margin-top: -3px; + bottom: 0; + background: #fff; + transition: all 0.3s; +` + +export const MenuItem = styled(Link)` + display: flex; + align-items: center; + font-size: 22px; + text-decoration: none; + color: #fff; + position: relative; + transition: color 0.3s; + margin: 10px 20px 5px 0; + font-family: "Oxygen Mono"; + + &:hover { + color: #fff; + } + + &:hover ${MenuItemLine} { + padding: 8px; + height: 100%; + background: #dd66a1; + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1), 0 5px 11px rgba(0, 0, 0, 0.25); + margin-left: -8px; + margin-bottom: -8px; + border-radius: 3px; + } + + &.disabled { + cursor: default; + pointer-events: none; + opacity: 0.7; + color: #fff !important; + } + + &.disabled ${MenuItemLine} { + bottom: 50%; + background: #fff !important; + } + + &.active { + font-weight: 700; + color: #dd66a1; + + ${MenuItemLine} { + background: #dd66a1; + } + + &:hover { + color: #fff; + } + + &:hover ${MenuItemLine} { + background: #dd66a1; + } + } +` diff --git a/src/components/MobileHeader/index.tsx b/src/components/HomeMobileHeader/index.tsx similarity index 56% rename from src/components/MobileHeader/index.tsx rename to src/components/HomeMobileHeader/index.tsx index 7f334fd..bff1b4e 100644 --- a/src/components/MobileHeader/index.tsx +++ b/src/components/HomeMobileHeader/index.tsx @@ -1,18 +1,18 @@ import React, { FC } from "react" import * as SC from "./styles" -interface IMobileHeaderProps { +interface IHomeMobileHeaderProps { openMenu: () => void } -export const MobileHeader: FC = ({ openMenu }) => { +export const HomeMobileHeader: FC = ({ openMenu }) => { return ( - + Resources - + ) } diff --git a/src/components/MobileHeader/styles.tsx b/src/components/HomeMobileHeader/styles.tsx similarity index 95% rename from src/components/MobileHeader/styles.tsx rename to src/components/HomeMobileHeader/styles.tsx index 99121a3..69aa2d6 100644 --- a/src/components/MobileHeader/styles.tsx +++ b/src/components/HomeMobileHeader/styles.tsx @@ -3,7 +3,7 @@ import styled from "styled-components" import { fontFamily } from "../../design/typography" import Logo from "../../images/tph-logo.svg" -export const MobileHeaderWrapper = styled.div` +export const HomeMobileHeaderWrapper = styled.div` z-index: 50; background: ${props => transparentize(0.2, props.theme.main.background)}; position: fixed; diff --git a/src/components/Partner/index.tsx b/src/components/HomePartner/index.tsx similarity index 64% rename from src/components/Partner/index.tsx rename to src/components/HomePartner/index.tsx index ea24c9d..bb64bbe 100644 --- a/src/components/Partner/index.tsx +++ b/src/components/HomePartner/index.tsx @@ -1,12 +1,12 @@ import React, { FC } from "react" import * as SC from "./styles" -export const Partner: FC = () => { +export const HomePartner: FC = () => { return ( - + Member of Supported user groups - + ) } diff --git a/src/components/Partner/styles.tsx b/src/components/HomePartner/styles.tsx similarity index 88% rename from src/components/Partner/styles.tsx rename to src/components/HomePartner/styles.tsx index 29b0498..40ae506 100644 --- a/src/components/Partner/styles.tsx +++ b/src/components/HomePartner/styles.tsx @@ -1,7 +1,7 @@ import styled from "styled-components" import JetBrainsLogo from "../../images/jetbrains-logo.svg" -export const PartnerWrapper = styled.div` +export const HomePartnerWrapper = styled.div` margin-top: 32px; display: flex; align-items: center; diff --git a/src/components/Link/index.tsx b/src/components/Link/index.tsx new file mode 100644 index 0000000..df35a7e --- /dev/null +++ b/src/components/Link/index.tsx @@ -0,0 +1,18 @@ +import React, { FC } from "react" +import * as SC from "./styles" + +interface ILinkProps { + to: string +} + +export const Link: FC = ({ children, to }) => { + if (!to.match(/^(https?:\/\/)/)) { + return {children} + } + + return ( + + {children} + + ) +} diff --git a/src/components/ColumnLink/styles.tsx b/src/components/Link/styles.tsx similarity index 78% rename from src/components/ColumnLink/styles.tsx rename to src/components/Link/styles.tsx index e2246b6..fb22cf1 100644 --- a/src/components/ColumnLink/styles.tsx +++ b/src/components/Link/styles.tsx @@ -15,10 +15,10 @@ const linkStyle = css` } ` -export const ColumnLinkInternal = styled(Link)` +export const LinkInternal = styled(Link)` ${linkStyle} ` -export const ColumnLinkExternal = styled.a` +export const LinkExternal = styled.a` ${linkStyle} ` diff --git a/src/components/ResourcesSidebar/index.tsx b/src/components/ResourcesSidebar/index.tsx index 913bbe6..af316ee 100644 --- a/src/components/ResourcesSidebar/index.tsx +++ b/src/components/ResourcesSidebar/index.tsx @@ -3,7 +3,7 @@ import React, { FC, HTMLAttributes, memo, useState } from "react" import TriangleDown from "../../icons/triangle-down.svg" import { IAllResourcesQuery, IFileOrFolder, IFolder } from "../../types" import { humanize } from "../../utils" -import { ColumnSidebar } from "../ColumnSidebar" +import { Sidebar } from "../Sidebar" import useBuildTree from "./../../hooks/useBuildTree" import useSidebar from "./../../hooks/useSidebar" import * as SC from "./styles" @@ -96,8 +96,8 @@ export const ResourcesSidebar: FC> = props => { const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title)) return ( - + {sortedTree.map((node, index) => plantTree(node, index, true))} - + ) } diff --git a/src/components/ColumnSidebar/index.tsx b/src/components/Sidebar/index.tsx similarity index 91% rename from src/components/ColumnSidebar/index.tsx rename to src/components/Sidebar/index.tsx index 758ff51..162b52e 100644 --- a/src/components/ColumnSidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -18,13 +18,13 @@ const MenuItem: FC = ({ children, to }) => { ) } -export const ColumnSidebar: FC< +export const Sidebar: FC< PropsWithChildren> > = props => { const { children, ...restProps } = props return ( - + @@ -44,6 +44,6 @@ export const ColumnSidebar: FC< - + ) } diff --git a/src/components/ColumnSidebar/styles.tsx b/src/components/Sidebar/styles.tsx similarity index 95% rename from src/components/ColumnSidebar/styles.tsx rename to src/components/Sidebar/styles.tsx index 1a13450..9df9c15 100644 --- a/src/components/ColumnSidebar/styles.tsx +++ b/src/components/Sidebar/styles.tsx @@ -1,7 +1,7 @@ import { Link } from "gatsby" import styled from "styled-components" -export const ColumnSidebarWrapper = styled.div` +export const SidebarWrapper = styled.div` box-sizing: border-box; flex: 0 0 320px; background: ${props => props.theme.sidebar.background}; diff --git a/src/layouts/ColumnLayout/index.tsx b/src/layouts/ColumnLayout/index.tsx index 0642fbf..e77a1be 100644 --- a/src/layouts/ColumnLayout/index.tsx +++ b/src/layouts/ColumnLayout/index.tsx @@ -1,7 +1,6 @@ import React, { FC, useMemo, useState } from "react" -import { ColumnSidebar } from "../../components/ColumnSidebar" -import { MobileHeader } from "../../components/MobileHeader" +import { HomeMobileHeader } from "../../components/HomeMobileHeader" import { GlobalStyles } from "../../globalStyles" import { useLockBodyScroll } from "../../hooks/useLockBodyScroll" import { SidebarProvider } from "../../SidebarProvider" @@ -32,7 +31,7 @@ export const ColumnLayout: FC = ({ sidebar, content }) => { - + {sidebar({ className: activeMobileMenu ? "is-open" : "" })} {content} diff --git a/src/layouts/Layout/index.tsx b/src/layouts/Layout/index.tsx index 8f63c2e..cd3d7b0 100644 --- a/src/layouts/Layout/index.tsx +++ b/src/layouts/Layout/index.tsx @@ -2,8 +2,8 @@ import { RouteComponentProps } from "@reach/router" import React, { FC, Fragment, useEffect } from "react" import { Container } from "../../components/Container" -import { Footer } from "../../components/Footer" -import { Header } from "../../components/Header" +import { HomeFooter } from "../../components/HomeFooter" +import { HomeHeader } from "../../components/HomeHeader" import { WavesBottom } from "../../components/Waves" import { GlobalStyles } from "../../globalStyles" import useLocation from "../../hooks/useLocation" @@ -25,13 +25,13 @@ export const Layout: FC = ({ children }) => { -
+ {!isHome && ( {children} -