This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Need this to work out which direction the scroll is happening | |
let lastScroll = 0; | |
// Store header component | |
const header = document.querySelector("header"); | |
// Element looks like this: <header class="transition-transform duration-300 fixed w-full"> | |
// On page scroll | |
window.addEventListener("scroll", () => { | |
// Store current page scroll pixels from top |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
// Normalise new lines from a textarea before outputting as JSX | |
export const Content = ({ content, className, lastParagraphMargin = "mb-0"}) => { | |
// Return null if there's no content passed to the component | |
if (!content || content.length === 0) { | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Adds fade on hover of an element or a specified child element | |
*/ | |
@mixin hover-fade($child: '') { | |
@if $child != '' { | |
#{$child} { | |
transition: opacity 0.33s linear; | |
} | |
} @else { | |
transition: opacity 0.33s linear; |