mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-08 07:56:12 +02:00
refact: rename Column components to be generic
This commit is contained in:
@@ -2,7 +2,7 @@ import { graphql, useStaticQuery } from "gatsby"
|
|||||||
import React, { FC, HTMLAttributes } from "react"
|
import React, { FC, HTMLAttributes } from "react"
|
||||||
import { IAllArchivesQuery, IFileOrFolder } from "../../types"
|
import { IAllArchivesQuery, IFileOrFolder } from "../../types"
|
||||||
import { humanize } from "../../utils"
|
import { humanize } from "../../utils"
|
||||||
import { ColumnSidebar } from "../ColumnSidebar"
|
import { Sidebar } from "../Sidebar"
|
||||||
import useBuildTree from "./../../hooks/useBuildTree"
|
import useBuildTree from "./../../hooks/useBuildTree"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
@@ -31,5 +31,5 @@ export const ArchivesSidebar: FC<HTMLAttributes<HTMLDivElement>> = props => {
|
|||||||
const tree = useBuildTree(archives, "/archives")
|
const tree = useBuildTree(archives, "/archives")
|
||||||
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title))
|
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title))
|
||||||
|
|
||||||
return <ColumnSidebar {...props}>{sortedTree.map(plantTree)}</ColumnSidebar>
|
return <Sidebar {...props}>{sortedTree.map(plantTree)}</Sidebar>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 = () => (
|
|
||||||
<Fragment>
|
|
||||||
<ChevronUp /> <SC.ExtraLinkText>{item}</SC.ExtraLinkText>
|
|
||||||
</Fragment>
|
|
||||||
)
|
|
||||||
|
|
||||||
if (external) {
|
|
||||||
return (
|
|
||||||
<SC.ExtraLinkExternal href={item} target="_blank">
|
|
||||||
<Inner />
|
|
||||||
</SC.ExtraLinkExternal>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SC.ExtraLinkInternal to={`/resources/${item}.md`}>
|
|
||||||
<Inner />
|
|
||||||
</SC.ExtraLinkInternal>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ColumnHeader: FC<IColumnHeaderProps> = ({
|
|
||||||
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 (
|
|
||||||
<SC.ColumnHeaderWrapper>
|
|
||||||
<Breadcrumb relativePath={relativePath} basePath={basePath} />
|
|
||||||
|
|
||||||
<SC.Title>{title}</SC.Title>
|
|
||||||
|
|
||||||
<SC.Top>
|
|
||||||
{authors && (
|
|
||||||
<SC.Meta>
|
|
||||||
<StackedAvatars authors={authors} />
|
|
||||||
<SC.PopoverToggler>
|
|
||||||
{authors.length} contributor{authors.length > 1 && "s"}
|
|
||||||
<SC.Popover>
|
|
||||||
{authors
|
|
||||||
.map(author => `${author.name}#${author.hash}`)
|
|
||||||
.join(", ")}
|
|
||||||
</SC.Popover>
|
|
||||||
</SC.PopoverToggler>
|
|
||||||
</SC.Meta>
|
|
||||||
)}
|
|
||||||
{dateToHuman && <SC.Meta>{dateToHuman}</SC.Meta>}
|
|
||||||
<SC.Meta>
|
|
||||||
{timeToRead} minute{timeToRead !== 1 && "s"} read time
|
|
||||||
</SC.Meta>
|
|
||||||
</SC.Top>
|
|
||||||
|
|
||||||
{recommendedReading && (
|
|
||||||
<SC.RecommendedReading>
|
|
||||||
Recommended reading
|
|
||||||
{recommendedReading.map(item => {
|
|
||||||
return <ExtraLink key={item} item={item} />
|
|
||||||
})}
|
|
||||||
</SC.RecommendedReading>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{externalResources && (
|
|
||||||
<SC.ExternalResources>
|
|
||||||
External Resources
|
|
||||||
{externalResources.map(item => {
|
|
||||||
return <ExtraLink key={item} item={item} external />
|
|
||||||
})}
|
|
||||||
</SC.ExternalResources>
|
|
||||||
)}
|
|
||||||
</SC.ColumnHeaderWrapper>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import React, { FC } from "react"
|
|
||||||
import * as SC from "./styles"
|
|
||||||
|
|
||||||
interface IColumnLinkProps {
|
|
||||||
to: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ColumnLink: FC<IColumnLinkProps> = ({ children, to }) => {
|
|
||||||
if (!to.match(/^(https?:\/\/)/)) {
|
|
||||||
return <SC.ColumnLinkInternal to={to}>{children}</SC.ColumnLinkInternal>
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SC.ColumnLinkExternal href={to} target="_blank">
|
|
||||||
{children}
|
|
||||||
</SC.ColumnLinkExternal>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,96 +1,112 @@
|
|||||||
import { Link } from "gatsby"
|
import React, { FC, Fragment } from "react"
|
||||||
import React, { FC, useLayoutEffect, useState } from "react"
|
|
||||||
import { DiscordButton } from "../DiscordButton"
|
import ChevronUp from "../../icons/chevron-up.svg"
|
||||||
import { Partner } from "../Partner"
|
import { Breadcrumb } from "../Breadcrumb"
|
||||||
import { WavesBottom, WavesTop } from "../Waves"
|
import { StackedAvatars } from "../StackedAvatars"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
interface IHeaderProps {
|
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 {
|
function ExtraLink({
|
||||||
to: string
|
item,
|
||||||
}
|
external = false,
|
||||||
|
}: {
|
||||||
|
item: string
|
||||||
|
external?: boolean
|
||||||
|
}) {
|
||||||
|
const Inner = () => (
|
||||||
|
<Fragment>
|
||||||
|
<ChevronUp /> <SC.ExtraLinkText>{item}</SC.ExtraLinkText>
|
||||||
|
</Fragment>
|
||||||
|
)
|
||||||
|
|
||||||
|
if (external) {
|
||||||
|
return (
|
||||||
|
<SC.ExtraLinkExternal href={item} target="_blank">
|
||||||
|
<Inner />
|
||||||
|
</SC.ExtraLinkExternal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const MenuItem: FC<IMenuItemProps> = ({ children, to }) => {
|
|
||||||
return (
|
return (
|
||||||
<SC.MenuItem
|
<SC.ExtraLinkInternal to={`/resources/${item}.md`}>
|
||||||
to={to}
|
<Inner />
|
||||||
activeClassName="active"
|
</SC.ExtraLinkInternal>
|
||||||
className={to === "/" ? "disabled" : ""}
|
|
||||||
>
|
|
||||||
<SC.MenuItemText>{children}</SC.MenuItemText>
|
|
||||||
<SC.MenuItemLine />
|
|
||||||
</SC.MenuItem>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Header: FC<IHeaderProps> = ({ isHome }) => {
|
export const Header: FC<IHeaderProps> = ({
|
||||||
// Hack to force Particle.js to rerender
|
basePath,
|
||||||
const [noop, setNoop] = useState(0)
|
relativePath,
|
||||||
useLayoutEffect(() => {
|
title,
|
||||||
setNoop(prevState => prevState + 1)
|
authors,
|
||||||
}, [isHome])
|
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 (
|
return (
|
||||||
<SC.HeaderWrapper className={isHome ? "is-home" : ""}>
|
<SC.HeaderWrapper>
|
||||||
<WavesTop />
|
<Breadcrumb relativePath={relativePath} basePath={basePath} />
|
||||||
<SC.FadedBottomWave>
|
|
||||||
<WavesBottom />
|
|
||||||
</SC.FadedBottomWave>
|
|
||||||
|
|
||||||
<SC.StyledParticles
|
<SC.Title>{title}</SC.Title>
|
||||||
key={noop}
|
|
||||||
params={{
|
<SC.Top>
|
||||||
particles: {
|
{authors && (
|
||||||
number: { value: 5, density: { enable: true, value_area: 500 } },
|
<SC.Meta>
|
||||||
color: { value: "#ffffff" },
|
<StackedAvatars authors={authors} />
|
||||||
opacity: {
|
<SC.PopoverToggler>
|
||||||
value: 0.5,
|
{authors.length} contributor{authors.length > 1 && "s"}
|
||||||
random: false,
|
<SC.Popover>
|
||||||
anim: { enable: false },
|
{authors
|
||||||
},
|
.map(author => `${author.name}#${author.hash}`)
|
||||||
size: {
|
.join(", ")}
|
||||||
value: 36,
|
</SC.Popover>
|
||||||
random: true,
|
</SC.PopoverToggler>
|
||||||
anim: { enable: false },
|
</SC.Meta>
|
||||||
},
|
)}
|
||||||
line_linked: {
|
{dateToHuman && <SC.Meta>{dateToHuman}</SC.Meta>}
|
||||||
enable: false,
|
<SC.Meta>
|
||||||
},
|
{timeToRead} minute{timeToRead !== 1 && "s"} read time
|
||||||
move: {
|
</SC.Meta>
|
||||||
enable: true,
|
</SC.Top>
|
||||||
speed: 1.5,
|
|
||||||
direction: "top",
|
{recommendedReading && (
|
||||||
random: false,
|
<SC.RecommendedReading>
|
||||||
straight: false,
|
Recommended reading
|
||||||
out_mode: "out",
|
{recommendedReading.map(item => {
|
||||||
bounce: false,
|
return <ExtraLink key={item} item={item} />
|
||||||
attract: { enable: false },
|
})}
|
||||||
},
|
</SC.RecommendedReading>
|
||||||
},
|
)}
|
||||||
retina_detect: true,
|
|
||||||
}}
|
{externalResources && (
|
||||||
/>
|
<SC.ExternalResources>
|
||||||
<SC.InnerWrapper>
|
External Resources
|
||||||
<SC.TitleWrapper>
|
{externalResources.map(item => {
|
||||||
<Link to="/">
|
return <ExtraLink key={item} item={item} external />
|
||||||
<SC.Logo />
|
})}
|
||||||
</Link>
|
</SC.ExternalResources>
|
||||||
<SC.Title>The Programmer's Hangout</SC.Title>
|
)}
|
||||||
</SC.TitleWrapper>
|
|
||||||
<SC.Menu>
|
|
||||||
<MenuItem to="/about">about</MenuItem>
|
|
||||||
<MenuItem to="/rules">rules</MenuItem>
|
|
||||||
<MenuItem to="/">faq</MenuItem>
|
|
||||||
<MenuItem to="/">hotbot</MenuItem>
|
|
||||||
<MenuItem to="/resources">resources</MenuItem>
|
|
||||||
<MenuItem to="/archives">tech spotlights</MenuItem>
|
|
||||||
</SC.Menu>
|
|
||||||
<DiscordButton>join us</DiscordButton>
|
|
||||||
{isHome && <Partner />}
|
|
||||||
</SC.InnerWrapper>
|
|
||||||
</SC.HeaderWrapper>
|
</SC.HeaderWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-167
@@ -1,192 +1,135 @@
|
|||||||
import { Link } from "gatsby"
|
import { Link } from "gatsby"
|
||||||
import Particles from "react-particles-js"
|
import { darken, lighten } from "polished"
|
||||||
import styled from "styled-components"
|
import styled, { css } from "styled-components"
|
||||||
import TPHLogo from "../../images/tph-logo.svg"
|
import { fontFamily, modularScale } from "../../design/typography"
|
||||||
|
|
||||||
export const HeaderWrapper = styled.header`
|
export const HeaderWrapper = styled.div`
|
||||||
display: flex;
|
border-bottom: 1px solid #dbdbdb;
|
||||||
justify-content: center;
|
padding-bottom: 32px;
|
||||||
align-items: center;
|
margin-bottom: 32px;
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
min-height: auto;
|
|
||||||
background: #1f2a34;
|
|
||||||
|
|
||||||
&.is-home {
|
|
||||||
min-height: 100vh;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
`
|
`
|
||||||
|
|
||||||
export const TitleWrapper = styled.div`
|
export const Top = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 22px;
|
|
||||||
|
|
||||||
.is-home & {
|
@media screen and (max-width: 767px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const Title = styled.h1`
|
export const Title = styled.h1`
|
||||||
margin: 0;
|
font-family: ${fontFamily.header};
|
||||||
font-weight: 700;
|
font-size: ${modularScale(6).fontSize}px;
|
||||||
font-size: 50px;
|
line-height: ${modularScale(6).lineHeight}px;
|
||||||
text-transform: uppercase;
|
letter-spacing: -1.75px;
|
||||||
line-height: 1;
|
margin-top: 0;
|
||||||
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`
|
export const Meta = 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;
|
display: flex;
|
||||||
align-items: center;
|
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 {
|
& + &::before {
|
||||||
color: #fff;
|
content: "•";
|
||||||
|
margin: 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover ${MenuItemLine} {
|
@media screen and (max-width: 767px) {
|
||||||
padding: 8px;
|
& + & {
|
||||||
height: 100%;
|
margin-top: 8px;
|
||||||
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 {
|
& + &::before {
|
||||||
color: #fff;
|
display: none;
|
||||||
}
|
|
||||||
|
|
||||||
&:hover ${MenuItemLine} {
|
|
||||||
background: #dd66a1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import packageJson from "../../../package.json"
|
|||||||
import { Container } from "../Container"
|
import { Container } from "../Container"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
export const Footer: FC = () => {
|
export const HomeFooter: FC = () => {
|
||||||
return (
|
return (
|
||||||
<SC.FooterWrapper>
|
<SC.HomeFooterWrapper>
|
||||||
<Container>
|
<Container>
|
||||||
<p>
|
<p>
|
||||||
© {new Date().getFullYear()}, Built with
|
© {new Date().getFullYear()}, Built with
|
||||||
@@ -14,6 +14,6 @@ export const Footer: FC = () => {
|
|||||||
<a href={packageJson.repository.url}>GitHub</a>
|
<a href={packageJson.repository.url}>GitHub</a>
|
||||||
</p>
|
</p>
|
||||||
</Container>
|
</Container>
|
||||||
</SC.FooterWrapper>
|
</SC.HomeFooterWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
|
|
||||||
export const FooterWrapper = styled.footer`
|
export const HomeFooterWrapper = styled.footer`
|
||||||
& a {
|
& a {
|
||||||
display: inline;
|
display: inline;
|
||||||
color: #0090d8;
|
color: #0090d8;
|
||||||
@@ -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<IMenuItemProps> = ({ children, to }) => {
|
||||||
|
return (
|
||||||
|
<SC.MenuItem
|
||||||
|
to={to}
|
||||||
|
activeClassName="active"
|
||||||
|
className={to === "/" ? "disabled" : ""}
|
||||||
|
>
|
||||||
|
<SC.MenuItemText>{children}</SC.MenuItemText>
|
||||||
|
<SC.MenuItemLine />
|
||||||
|
</SC.MenuItem>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HomeHeader: FC<IHomeHeaderProps> = ({ isHome }) => {
|
||||||
|
// Hack to force Particle.js to rerender
|
||||||
|
const [noop, setNoop] = useState(0)
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
setNoop(prevState => prevState + 1)
|
||||||
|
}, [isHome])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SC.HomeHeaderWrapper className={isHome ? "is-home" : ""}>
|
||||||
|
<WavesTop />
|
||||||
|
<SC.FadedBottomWave>
|
||||||
|
<WavesBottom />
|
||||||
|
</SC.FadedBottomWave>
|
||||||
|
|
||||||
|
<SC.StyledParticles
|
||||||
|
key={noop}
|
||||||
|
params={{
|
||||||
|
particles: {
|
||||||
|
number: { value: 5, density: { enable: true, value_area: 500 } },
|
||||||
|
color: { value: "#ffffff" },
|
||||||
|
opacity: {
|
||||||
|
value: 0.5,
|
||||||
|
random: false,
|
||||||
|
anim: { enable: false },
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
value: 36,
|
||||||
|
random: true,
|
||||||
|
anim: { enable: false },
|
||||||
|
},
|
||||||
|
line_linked: {
|
||||||
|
enable: false,
|
||||||
|
},
|
||||||
|
move: {
|
||||||
|
enable: true,
|
||||||
|
speed: 1.5,
|
||||||
|
direction: "top",
|
||||||
|
random: false,
|
||||||
|
straight: false,
|
||||||
|
out_mode: "out",
|
||||||
|
bounce: false,
|
||||||
|
attract: { enable: false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
retina_detect: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<SC.InnerWrapper>
|
||||||
|
<SC.TitleWrapper>
|
||||||
|
<Link to="/">
|
||||||
|
<SC.Logo />
|
||||||
|
</Link>
|
||||||
|
<SC.Title>The Programmer's Hangout</SC.Title>
|
||||||
|
</SC.TitleWrapper>
|
||||||
|
<SC.Menu>
|
||||||
|
<MenuItem to="/about">about</MenuItem>
|
||||||
|
<MenuItem to="/rules">rules</MenuItem>
|
||||||
|
<MenuItem to="/">faq</MenuItem>
|
||||||
|
<MenuItem to="/">hotbot</MenuItem>
|
||||||
|
<MenuItem to="/resources">resources</MenuItem>
|
||||||
|
<MenuItem to="/archives">tech spotlights</MenuItem>
|
||||||
|
</SC.Menu>
|
||||||
|
<DiscordButton>join us</DiscordButton>
|
||||||
|
{isHome && <HomePartner />}
|
||||||
|
</SC.InnerWrapper>
|
||||||
|
</SC.HomeHeaderWrapper>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import React, { FC } from "react"
|
import React, { FC } from "react"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
interface IMobileHeaderProps {
|
interface IHomeMobileHeaderProps {
|
||||||
openMenu: () => void
|
openMenu: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MobileHeader: FC<IMobileHeaderProps> = ({ openMenu }) => {
|
export const HomeMobileHeader: FC<IHomeMobileHeaderProps> = ({ openMenu }) => {
|
||||||
return (
|
return (
|
||||||
<SC.MobileHeaderWrapper>
|
<SC.HomeMobileHeaderWrapper>
|
||||||
<SC.LogoWrapper>
|
<SC.LogoWrapper>
|
||||||
<SC.StyledLogo />
|
<SC.StyledLogo />
|
||||||
</SC.LogoWrapper>
|
</SC.LogoWrapper>
|
||||||
Resources
|
Resources
|
||||||
<SC.Burger onClick={openMenu} />
|
<SC.Burger onClick={openMenu} />
|
||||||
</SC.MobileHeaderWrapper>
|
</SC.HomeMobileHeaderWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ import styled from "styled-components"
|
|||||||
import { fontFamily } from "../../design/typography"
|
import { fontFamily } from "../../design/typography"
|
||||||
import Logo from "../../images/tph-logo.svg"
|
import Logo from "../../images/tph-logo.svg"
|
||||||
|
|
||||||
export const MobileHeaderWrapper = styled.div`
|
export const HomeMobileHeaderWrapper = styled.div`
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
background: ${props => transparentize(0.2, props.theme.main.background)};
|
background: ${props => transparentize(0.2, props.theme.main.background)};
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import React, { FC } from "react"
|
import React, { FC } from "react"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
export const Partner: FC = () => {
|
export const HomePartner: FC = () => {
|
||||||
return (
|
return (
|
||||||
<SC.PartnerWrapper>
|
<SC.HomePartnerWrapper>
|
||||||
Member of
|
Member of
|
||||||
<SC.StyledJetBrainsLogo alt="JetBrains" />
|
<SC.StyledJetBrainsLogo alt="JetBrains" />
|
||||||
Supported user groups
|
Supported user groups
|
||||||
</SC.PartnerWrapper>
|
</SC.HomePartnerWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
import JetBrainsLogo from "../../images/jetbrains-logo.svg"
|
import JetBrainsLogo from "../../images/jetbrains-logo.svg"
|
||||||
|
|
||||||
export const PartnerWrapper = styled.div`
|
export const HomePartnerWrapper = styled.div`
|
||||||
margin-top: 32px;
|
margin-top: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React, { FC } from "react"
|
||||||
|
import * as SC from "./styles"
|
||||||
|
|
||||||
|
interface ILinkProps {
|
||||||
|
to: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Link: FC<ILinkProps> = ({ children, to }) => {
|
||||||
|
if (!to.match(/^(https?:\/\/)/)) {
|
||||||
|
return <SC.LinkInternal to={to}>{children}</SC.LinkInternal>
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SC.LinkExternal href={to} target="_blank">
|
||||||
|
{children}
|
||||||
|
</SC.LinkExternal>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -15,10 +15,10 @@ const linkStyle = css`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const ColumnLinkInternal = styled(Link)`
|
export const LinkInternal = styled(Link)`
|
||||||
${linkStyle}
|
${linkStyle}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const ColumnLinkExternal = styled.a`
|
export const LinkExternal = styled.a`
|
||||||
${linkStyle}
|
${linkStyle}
|
||||||
`
|
`
|
||||||
@@ -3,7 +3,7 @@ import React, { FC, HTMLAttributes, memo, useState } from "react"
|
|||||||
import TriangleDown from "../../icons/triangle-down.svg"
|
import TriangleDown from "../../icons/triangle-down.svg"
|
||||||
import { IAllResourcesQuery, IFileOrFolder, IFolder } from "../../types"
|
import { IAllResourcesQuery, IFileOrFolder, IFolder } from "../../types"
|
||||||
import { humanize } from "../../utils"
|
import { humanize } from "../../utils"
|
||||||
import { ColumnSidebar } from "../ColumnSidebar"
|
import { Sidebar } from "../Sidebar"
|
||||||
import useBuildTree from "./../../hooks/useBuildTree"
|
import useBuildTree from "./../../hooks/useBuildTree"
|
||||||
import useSidebar from "./../../hooks/useSidebar"
|
import useSidebar from "./../../hooks/useSidebar"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
@@ -96,8 +96,8 @@ export const ResourcesSidebar: FC<HTMLAttributes<HTMLDivElement>> = props => {
|
|||||||
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title))
|
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ColumnSidebar {...props}>
|
<Sidebar {...props}>
|
||||||
{sortedTree.map((node, index) => plantTree(node, index, true))}
|
{sortedTree.map((node, index) => plantTree(node, index, true))}
|
||||||
</ColumnSidebar>
|
</Sidebar>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ const MenuItem: FC<IMenuItemProps> = ({ children, to }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ColumnSidebar: FC<
|
export const Sidebar: FC<
|
||||||
PropsWithChildren<HTMLAttributes<HTMLDivElement>>
|
PropsWithChildren<HTMLAttributes<HTMLDivElement>>
|
||||||
> = props => {
|
> = props => {
|
||||||
const { children, ...restProps } = props
|
const { children, ...restProps } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SC.ColumnSidebarWrapper {...restProps}>
|
<SC.SidebarWrapper {...restProps}>
|
||||||
<Scrollbar>
|
<Scrollbar>
|
||||||
<Link to="/">
|
<Link to="/">
|
||||||
<Banner />
|
<Banner />
|
||||||
@@ -44,6 +44,6 @@ export const ColumnSidebar: FC<
|
|||||||
<ThemeToggler />
|
<ThemeToggler />
|
||||||
</SC.Inner>
|
</SC.Inner>
|
||||||
</Scrollbar>
|
</Scrollbar>
|
||||||
</SC.ColumnSidebarWrapper>
|
</SC.SidebarWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Link } from "gatsby"
|
import { Link } from "gatsby"
|
||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
|
|
||||||
export const ColumnSidebarWrapper = styled.div`
|
export const SidebarWrapper = styled.div`
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex: 0 0 320px;
|
flex: 0 0 320px;
|
||||||
background: ${props => props.theme.sidebar.background};
|
background: ${props => props.theme.sidebar.background};
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, { FC, useMemo, useState } from "react"
|
import React, { FC, useMemo, useState } from "react"
|
||||||
|
|
||||||
import { ColumnSidebar } from "../../components/ColumnSidebar"
|
import { HomeMobileHeader } from "../../components/HomeMobileHeader"
|
||||||
import { MobileHeader } from "../../components/MobileHeader"
|
|
||||||
import { GlobalStyles } from "../../globalStyles"
|
import { GlobalStyles } from "../../globalStyles"
|
||||||
import { useLockBodyScroll } from "../../hooks/useLockBodyScroll"
|
import { useLockBodyScroll } from "../../hooks/useLockBodyScroll"
|
||||||
import { SidebarProvider } from "../../SidebarProvider"
|
import { SidebarProvider } from "../../SidebarProvider"
|
||||||
@@ -32,7 +31,7 @@ export const ColumnLayout: FC<IColumnLayoutProps> = ({ sidebar, content }) => {
|
|||||||
<SidebarProvider>
|
<SidebarProvider>
|
||||||
<GlobalStyles />
|
<GlobalStyles />
|
||||||
<SC.Main>
|
<SC.Main>
|
||||||
<MobileHeader openMenu={openMenu} />
|
<HomeMobileHeader openMenu={openMenu} />
|
||||||
{sidebar({ className: activeMobileMenu ? "is-open" : "" })}
|
{sidebar({ className: activeMobileMenu ? "is-open" : "" })}
|
||||||
<SC.MainContent>
|
<SC.MainContent>
|
||||||
<SC.Container>{content}</SC.Container>
|
<SC.Container>{content}</SC.Container>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { RouteComponentProps } from "@reach/router"
|
|||||||
import React, { FC, Fragment, useEffect } from "react"
|
import React, { FC, Fragment, useEffect } from "react"
|
||||||
|
|
||||||
import { Container } from "../../components/Container"
|
import { Container } from "../../components/Container"
|
||||||
import { Footer } from "../../components/Footer"
|
import { HomeFooter } from "../../components/HomeFooter"
|
||||||
import { Header } from "../../components/Header"
|
import { HomeHeader } from "../../components/HomeHeader"
|
||||||
import { WavesBottom } from "../../components/Waves"
|
import { WavesBottom } from "../../components/Waves"
|
||||||
import { GlobalStyles } from "../../globalStyles"
|
import { GlobalStyles } from "../../globalStyles"
|
||||||
import useLocation from "../../hooks/useLocation"
|
import useLocation from "../../hooks/useLocation"
|
||||||
@@ -25,13 +25,13 @@ export const Layout: FC<RouteComponentProps> = ({ children }) => {
|
|||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
<SC.LayoutWrapper>
|
<SC.LayoutWrapper>
|
||||||
<GlobalStyles />
|
<GlobalStyles />
|
||||||
<Header isHome={isHome} />
|
<HomeHeader isHome={isHome} />
|
||||||
{!isHome && (
|
{!isHome && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SC.MainContent>
|
<SC.MainContent>
|
||||||
<Container>{children}</Container>
|
<Container>{children}</Container>
|
||||||
</SC.MainContent>
|
</SC.MainContent>
|
||||||
<Footer />
|
<HomeFooter />
|
||||||
<WavesBottom />
|
<WavesBottom />
|
||||||
<SC.WavesSpacer />
|
<SC.WavesSpacer />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import React, { Fragment } from "react"
|
import React, { Fragment } from "react"
|
||||||
|
|
||||||
import { ColumnLink } from "../components/ColumnLink"
|
import { Link } from "../components/Link"
|
||||||
import { SEO } from "../components/SEO"
|
import { SEO } from "../components/SEO"
|
||||||
|
|
||||||
function ResourcesPage() {
|
function ArchivesPage() {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SEO title="Tech Spotlights Archives" />
|
<SEO title="Tech Spotlights Archives" />
|
||||||
@@ -11,11 +11,10 @@ function ResourcesPage() {
|
|||||||
<p>
|
<p>
|
||||||
This regroups the archives of our occasional, temporary channels that
|
This regroups the archives of our occasional, temporary channels that
|
||||||
cover a piece of technology that might be unknown to part of our users.
|
cover a piece of technology that might be unknown to part of our users.
|
||||||
You can find those on{" "}
|
You can find those on <Link to="/about">The Programmer's Hangout</Link>.
|
||||||
<ColumnLink to="/about">The Programmer's Hangout</ColumnLink>.
|
|
||||||
</p>
|
</p>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ResourcesPage
|
export default ArchivesPage
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment } from "react"
|
import React, { Fragment } from "react"
|
||||||
|
|
||||||
import packageJson from "../../package.json"
|
import packageJson from "../../package.json"
|
||||||
import { ColumnLink } from "../components/ColumnLink"
|
import { Link } from "../components/Link"
|
||||||
import { ResourcesList } from "../components/ResourcesList"
|
import { ResourcesList } from "../components/ResourcesList"
|
||||||
import { SEO } from "../components/SEO"
|
import { SEO } from "../components/SEO"
|
||||||
|
|
||||||
@@ -13,11 +13,11 @@ function ResourcesPage() {
|
|||||||
<p>
|
<p>
|
||||||
This is meant as a small knowledge base for commonly answered questions
|
This is meant as a small knowledge base for commonly answered questions
|
||||||
on our Discord community,{" "}
|
on our Discord community,{" "}
|
||||||
<ColumnLink to="/about">The Programmer's Hangout</ColumnLink>.
|
<Link to="/about">The Programmer's Hangout</Link>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
All of it is open source, and you can contribute to it on{" "}
|
All of it is open source, and you can contribute to it on{" "}
|
||||||
<ColumnLink to={packageJson.repository.url}>GitHub</ColumnLink>.
|
<Link to={packageJson.repository.url}>GitHub</Link>.
|
||||||
</p>
|
</p>
|
||||||
<ResourcesList />
|
<ResourcesList />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { graphql } from "gatsby"
|
import { graphql } from "gatsby"
|
||||||
import React, { FC, Fragment } from "react"
|
import React, { FC, Fragment } from "react"
|
||||||
import { ColumnHeader } from "../components/ColumnHeader"
|
import { Header } from "../components/Header"
|
||||||
import { Markdown } from "../components/Markdown"
|
import { Markdown } from "../components/Markdown"
|
||||||
import { SEO } from "../components/SEO"
|
import { SEO } from "../components/SEO"
|
||||||
import { humanize } from "../utils"
|
import { humanize } from "../utils"
|
||||||
@@ -15,7 +15,7 @@ const Archive: FC<any> = ({ data }) => {
|
|||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SEO title={title} description={excerpt} />
|
<SEO title={title} description={excerpt} />
|
||||||
<ColumnHeader
|
<Header
|
||||||
relativePath={relativePath}
|
relativePath={relativePath}
|
||||||
basePath="/archives"
|
basePath="/archives"
|
||||||
title={title}
|
title={title}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { graphql } from "gatsby"
|
import { graphql } from "gatsby"
|
||||||
import React, { FC, Fragment } from "react"
|
import React, { FC, Fragment } from "react"
|
||||||
import { ColumnHeader } from "../components/ColumnHeader"
|
import { Header } from "../components/Header"
|
||||||
import { Markdown } from "../components/Markdown"
|
import { Markdown } from "../components/Markdown"
|
||||||
import { SEO } from "../components/SEO"
|
import { SEO } from "../components/SEO"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ const LanguagePost: FC<any> = ({ data }) => {
|
|||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SEO title={frontmatter.title} description={excerpt} />
|
<SEO title={frontmatter.title} description={excerpt} />
|
||||||
<ColumnHeader
|
<Header
|
||||||
relativePath={relativePath}
|
relativePath={relativePath}
|
||||||
basePath="/resources"
|
basePath="/resources"
|
||||||
title={frontmatter.title}
|
title={frontmatter.title}
|
||||||
|
|||||||
Reference in New Issue
Block a user