mirror of
https://github.com/System-End/site.git
synced 2026-04-19 19:45:07 +00:00
* Begin Elon page * Get content on Elon page * Add content * First pass * Small change * Light second pass * Round 3 updates * Small wording change * Do another pass * Remove biography paragraph * Grammar * Wording * Break out sentence into own paragraph * Grammar * More small changes * Fix small issue * More small adjustments * Final small changes for this pass * Link Hack Club Bank * Add preface * Clarify that I had skillz * Add frank.ly * Clarify how money is spent in Elon text * Add social card to Elon page * Add Zach's signature * Begin Elon page * Get content on Elon page * Add content * First pass * Small change * Light second pass * Round 3 updates * Small wording change * Do another pass * Remove biography paragraph * Grammar * Wording * Break out sentence into own paragraph * Grammar * More small changes * Fix small issue * More small adjustments * Final small changes for this pass * Link Hack Club Bank * Add preface * Clarify that I had skillz * Add frank.ly * Clarify how money is spent in Elon text * Add social card to Elon page * Add Zach's signature * Update to latest * Add my name under signature * Upgrade dependencies * Add sparkles * Continue editing Elon page * Improve badges * Rebase * Update card * Pass of latest copy * Small wording improvements * Switch to @hackclub/meta 1.0.0 * Improve readability * Add homepage announcement * Fix meta tags on Elon page Co-authored-by: Zach Latta <zach@zachlatta.com> Co-authored-by: Christina Asquith <60162904+christinaasquith@users.noreply.github.com>
32 lines
1 KiB
JavaScript
32 lines
1 KiB
JavaScript
// Full credit to https://joshwcomeau.com/snippets/react-hooks/use-prefers-reduced-motion
|
|
import React from 'react'
|
|
|
|
const QUERY = '(prefers-reduced-motion: no-preference)'
|
|
const isRenderingOnServer = typeof window === 'undefined'
|
|
|
|
const getInitialState = () => {
|
|
// For our initial server render, we won't know if the user
|
|
// prefers reduced motion, but it doesn't matter. This value
|
|
// will be overwritten on the client, before any animations
|
|
// occur.
|
|
return isRenderingOnServer ? true : !window.matchMedia(QUERY).matches
|
|
}
|
|
|
|
function usePrefersReducedMotion() {
|
|
const [prefersReducedMotion, setPrefersReducedMotion] = React.useState(
|
|
getInitialState
|
|
)
|
|
React.useEffect(() => {
|
|
const mediaQueryList = window.matchMedia(QUERY)
|
|
const listener = event => {
|
|
setPrefersReducedMotion(!event.matches)
|
|
}
|
|
mediaQueryList.addListener(listener)
|
|
return () => {
|
|
mediaQueryList.removeListener(listener)
|
|
}
|
|
}, [])
|
|
return prefersReducedMotion
|
|
}
|
|
|
|
export default usePrefersReducedMotion
|