mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-08 23:44:09 +02:00
refact(header): clean up home checks
This commit is contained in:
@@ -28,9 +28,9 @@ export function Header({ isHome }: IHeaderProps) {
|
|||||||
}, [isHome])
|
}, [isHome])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SC.HeaderWrapper isHome={isHome}>
|
<SC.HeaderWrapper className={isHome ? "is-home" : ""}>
|
||||||
<WavesTop />
|
<WavesTop />
|
||||||
<SC.FadedBottomWave faded={!isHome}>
|
<SC.FadedBottomWave>
|
||||||
<WavesBottom />
|
<WavesBottom />
|
||||||
</SC.FadedBottomWave>
|
</SC.FadedBottomWave>
|
||||||
|
|
||||||
@@ -68,10 +68,12 @@ export function Header({ isHome }: IHeaderProps) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<SC.InnerWrapper>
|
<SC.InnerWrapper>
|
||||||
<Link to="/">
|
<SC.TitleWrapper>
|
||||||
<SC.Logo />
|
<Link to="/">
|
||||||
</Link>
|
<SC.Logo />
|
||||||
<SC.Title>The Programmer's Hangout</SC.Title>
|
</Link>
|
||||||
|
<SC.Title>The Programmer's Hangout</SC.Title>
|
||||||
|
</SC.TitleWrapper>
|
||||||
<SC.Menu>
|
<SC.Menu>
|
||||||
<MenuItem to="/about">about</MenuItem>
|
<MenuItem to="/about">about</MenuItem>
|
||||||
<MenuItem to="/rules">rules</MenuItem>
|
<MenuItem to="/rules">rules</MenuItem>
|
||||||
|
|||||||
@@ -4,15 +4,19 @@ import styled from "styled-components"
|
|||||||
import DiscordLogo from "../../images/discord-logo.svg"
|
import DiscordLogo from "../../images/discord-logo.svg"
|
||||||
import TPHLogo from "../../images/tph-logo.svg"
|
import TPHLogo from "../../images/tph-logo.svg"
|
||||||
|
|
||||||
export const HeaderWrapper = styled.header<{ isHome: boolean }>`
|
export const HeaderWrapper = 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: ${props => (props.isHome ? "100vh" : "auto")};
|
min-height: auto;
|
||||||
background: #121240;
|
background: #121240;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.is-home {
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const Title = styled.h1`
|
export const Title = styled.h1`
|
||||||
@@ -33,22 +37,27 @@ export const Title = styled.h1`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const FadedBottomWave = styled.div<{ faded: boolean }>`
|
export const FadedBottomWave = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translateY(${props => (props.faded ? "100%" : 0)});
|
transform: translateY(100%);
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
transition: opacity 0.5s, transform 0.5s;
|
transition: opacity 0.5s, transform 0.5s;
|
||||||
opacity: ${props => (props.faded ? 0 : 1)};
|
opacity: 0;
|
||||||
|
|
||||||
${props =>
|
svg {
|
||||||
props.faded &&
|
position: static;
|
||||||
css`
|
}
|
||||||
svg {
|
|
||||||
position: static;
|
.is-home & {
|
||||||
}
|
opacity: 1;
|
||||||
`}
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-home & svg {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const StyledParticles = styled(Particles)<{ noop: number }>`
|
export const StyledParticles = styled(Particles)<{ noop: number }>`
|
||||||
|
|||||||
Reference in New Issue
Block a user