mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
Merge pull request #215 from mahanthathreyee/home-header-cleanup
Home header cleanup
This commit is contained in:
@@ -1,14 +1,10 @@
|
|||||||
import { Link } from "gatsby"
|
import { Link } from "gatsby"
|
||||||
import React, { FC, useLayoutEffect, useState } from "react"
|
import React, { FC } from "react"
|
||||||
import { DiscordButton } from "../DiscordButton"
|
import { DiscordButton } from "../DiscordButton"
|
||||||
import { HomePartner } from "../HomePartner"
|
import { HomePartner } from "../HomePartner"
|
||||||
import { WavesBottom, WavesTop } from "../Waves"
|
import { WavesBottom, WavesTop } from "../Waves"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
interface IHomeHeaderProps {
|
|
||||||
isHome: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IMenuItemProps {
|
interface IMenuItemProps {
|
||||||
to: string
|
to: string
|
||||||
}
|
}
|
||||||
@@ -35,22 +31,15 @@ const MenuItem: FC<IMenuItemProps> = ({ children, to }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HomeHeader: FC<IHomeHeaderProps> = ({ isHome }) => {
|
export const Home: FC = () => {
|
||||||
// Hack to force Particle.js to rerender
|
|
||||||
const [noop, setNoop] = useState(0)
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
setNoop(prevState => prevState + 1)
|
|
||||||
}, [isHome])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SC.HomeHeaderWrapper className={isHome ? "is-home" : ""}>
|
<SC.HomeWrapper>
|
||||||
<WavesTop />
|
<WavesTop />
|
||||||
<SC.FadedBottomWave>
|
<SC.FadedBottomWave>
|
||||||
<WavesBottom />
|
<WavesBottom />
|
||||||
</SC.FadedBottomWave>
|
</SC.FadedBottomWave>
|
||||||
|
|
||||||
<SC.StyledParticles
|
<SC.StyledParticles
|
||||||
key={noop}
|
|
||||||
params={{
|
params={{
|
||||||
particles: {
|
particles: {
|
||||||
number: { value: 5, density: { enable: true, value_area: 500 } },
|
number: { value: 5, density: { enable: true, value_area: 500 } },
|
||||||
@@ -99,8 +88,8 @@ export const HomeHeader: FC<IHomeHeaderProps> = ({ isHome }) => {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</SC.Menu>
|
</SC.Menu>
|
||||||
<DiscordButton>join us</DiscordButton>
|
<DiscordButton>join us</DiscordButton>
|
||||||
{isHome && <HomePartner />}
|
<HomePartner />
|
||||||
</SC.InnerWrapper>
|
</SC.InnerWrapper>
|
||||||
</SC.HomeHeaderWrapper>
|
</SC.HomeWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3,58 +3,38 @@ import Particles from "react-particles-js"
|
|||||||
import styled, { css } from "styled-components"
|
import styled, { css } from "styled-components"
|
||||||
import TPHLogo from "../../images/tph-logo.svg"
|
import TPHLogo from "../../images/tph-logo.svg"
|
||||||
|
|
||||||
export const HomeHeaderWrapper = styled.header`
|
export const HomeWrapper = styled.header`
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: auto;
|
min-height: 100vh;
|
||||||
background: #1f2a34;
|
background: #1f2a34;
|
||||||
|
overflow: hidden;
|
||||||
&.is-home {
|
|
||||||
min-height: 100vh;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
`
|
`
|
||||||
|
|
||||||
export const TitleWrapper = styled.div`
|
export const TitleWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
margin-bottom: 22px;
|
margin-bottom: 22px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
flex-direction: column;
|
||||||
.is-home & {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
`
|
`
|
||||||
|
|
||||||
export const Title = styled.h1`
|
export const Title = styled.h1`
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 50px;
|
font-size: 88px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
||||||
|
margin: 32px 0;
|
||||||
.is-home & {
|
max-width: 100%;
|
||||||
margin: 32px 0;
|
|
||||||
font-size: 88px;
|
|
||||||
max-width: 100%;
|
|
||||||
|
|
||||||
@media screen and (max-width: 991px) {
|
|
||||||
font-size: 58px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 767px) {
|
|
||||||
font-size: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 991px) {
|
@media screen and (max-width: 991px) {
|
||||||
font-size: 42px;
|
font-size: 58px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 767px) {
|
@media screen and (max-width: 767px) {
|
||||||
@@ -64,26 +44,14 @@ export const Title = styled.h1`
|
|||||||
|
|
||||||
export const FadedBottomWave = styled.div`
|
export const FadedBottomWave = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translateY(100%);
|
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
position: static;
|
position: static;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-home & {
|
|
||||||
opacity: 1;
|
|
||||||
transition: opacity 0.5s, transform 0.5s;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-home & svg {
|
|
||||||
position: static;
|
|
||||||
}
|
|
||||||
`
|
`
|
||||||
|
|
||||||
export const StyledParticles = styled(Particles)`
|
export const StyledParticles = styled(Particles)`
|
||||||
@@ -116,11 +84,8 @@ export const Logo = styled(TPHLogo)`
|
|||||||
margin: 0 15px 0 0;
|
margin: 0 15px 0 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
|
width: 98px;
|
||||||
.is-home & {
|
margin-bottom: 0 0 10px 0;
|
||||||
width: 98px;
|
|
||||||
margin-bottom: 0 0 10px 0;
|
|
||||||
}
|
|
||||||
`
|
`
|
||||||
|
|
||||||
export const Menu = styled.nav`
|
export const Menu = styled.nav`
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
import { RouteComponentProps } from "@reach/router"
|
import { RouteComponentProps } from "@reach/router"
|
||||||
import React, { FC, useEffect } from "react"
|
import React, { FC, useEffect } from "react"
|
||||||
|
|
||||||
import { HomeHeader } from "../../components/HomeHeader"
|
import { Home } from "../../components/Home"
|
||||||
import { SEO } from "../../components/SEO"
|
import { SEO } from "../../components/SEO"
|
||||||
import { GlobalStyles } from "../../globalStyles"
|
import { GlobalStyles } from "../../globalStyles"
|
||||||
import useLocation from "../../hooks/useLocation"
|
|
||||||
import { useLockBodyScroll } from "../../hooks/useLockBodyScroll"
|
import { useLockBodyScroll } from "../../hooks/useLockBodyScroll"
|
||||||
import { ThemeProvider } from "../../ThemeProvider"
|
import { ThemeProvider } from "../../ThemeProvider"
|
||||||
import * as SC from "./styles"
|
import * as SC from "./styles"
|
||||||
|
|
||||||
export const HomeLayout: FC<RouteComponentProps> = () => {
|
export const HomeLayout: FC<RouteComponentProps> = () => {
|
||||||
const { isHome } = useLocation()
|
|
||||||
const { locked, unlock } = useLockBodyScroll()
|
const { locked, unlock } = useLockBodyScroll()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -27,7 +25,7 @@ export const HomeLayout: FC<RouteComponentProps> = () => {
|
|||||||
title="Home"
|
title="Home"
|
||||||
description="The Programmer's Hangout (TPH) is a discord community geared towards programming."
|
description="The Programmer's Hangout (TPH) is a discord community geared towards programming."
|
||||||
/>
|
/>
|
||||||
<HomeHeader isHome={isHome} />
|
<Home />
|
||||||
</SC.LayoutWrapper>
|
</SC.LayoutWrapper>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user