diff --git a/src/components/HeaderBarebone/index.tsx b/src/components/HeaderBarebone/index.tsx index 17bc6e4..a0fe2db 100644 --- a/src/components/HeaderBarebone/index.tsx +++ b/src/components/HeaderBarebone/index.tsx @@ -17,7 +17,7 @@ interface IBoxedTitleProps { } type HeaderBareboneState = { - scrollY: Number + scrollY: number } const BoxedTitle: React.FC = (props) => { @@ -39,6 +39,29 @@ const BoxedTitle: React.FC = (props) => { ) } +const StickyBoxedTitle: React.FC = (props) => { + return ( + + {props.above} + + + {props.children} + + + {props.content} + + ) +} + +const StickyContainer: React.FC = ({ children, ...restProps }) => { + return {children} +} + const debounce = (fn) => { let frame return (...params) => { @@ -52,11 +75,15 @@ const debounce = (fn) => { } export class HeaderBarebone extends Component { + controller: AbortController + state: HeaderBareboneState = { + scrollY: 0 + } constructor(props) { super(props) this.tick = this.tick.bind(this) - this.state = { scrollY: 0 } + this.controller = new AbortController() } tick() { @@ -67,32 +94,51 @@ export class HeaderBarebone extends Component - + - - {(isBoxed && this.state.scrollY < 30) && ( - + + {isBoxed && ( + {props.title} - + )} {!isBoxed && {props.title}} - + - ) + ) + } else { + return ( + + + + + {isBoxed && ( + + {props.title} + + )} + + {!isBoxed && {props.title}} + + + ) + } } } diff --git a/src/components/HeaderBarebone/styles.tsx b/src/components/HeaderBarebone/styles.tsx index 95c4207..ecce209 100644 --- a/src/components/HeaderBarebone/styles.tsx +++ b/src/components/HeaderBarebone/styles.tsx @@ -9,6 +9,11 @@ import HeaderMobile from "../../images/header-mobile-375x300.png" const spaceAbove = 67 const height = 300 - spaceAbove +export const StickyContainerWrapper = styled.div` + margin: 0; + width: 100%; +` + export const HeaderWrapper = styled.div` display: flex; width: 100%; @@ -34,6 +39,31 @@ export const HeaderWrapper = styled.div` } ` +export const HeaderWrapperSticky = styled.div` + display: flex; + width: 100%; + height: 7px; + padding-top: ${spaceAbove}px; + position: fixed; + + &.shifted { + width: calc(100% - 305px); + padding-right: 305px; + } + + @media screen and (max-width: 1200px) { + width: 100% !important; + padding-right: 0 !important; + } + + @media screen and (max-width: 767px) { + display: flex; + align-items: flex-end; + height: auto; + min-height: ${height}px; + } +` + export const Background = styled.div` position: absolute; top: 0; @@ -99,6 +129,39 @@ export const Box = styled.div` } ` +export const StickyBox = styled.div` + display: inline-flex; + flex-direction: column; + position: absolute; + bottom: 0; + background: ${(props) => transparentize(0.3, props.theme.main.background)}; + padding: 16px; + backdrop-filter: blur(14px); + width: 100%; + + @media screen and (max-width: 1200px) { + max-width: 100%; + left: 32px; + right: 32px; + margin-left: 0; + } + + @media screen and (max-width: 767px) { + position: static; + bottom: auto; + top: auto; + margin: 32px 0; + left: 0px; + right: 0px; + + @-moz-document url-prefix() { + & { + position: relative; + } + } + } +` + const title = css` font-family: ${fontFamily.header}; font-size: 34px;