Remove jquery dependency in favor of css smooth scroll (#660)

This commit is contained in:
Ella 2022-12-29 14:52:33 -05:00 committed by GitHub
parent 8b2ac23974
commit 354bd91beb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 28 deletions

View file

@ -35,7 +35,6 @@
"globby": "^11.0.4",
"graphql": "^16.6.0",
"gsap": "^3.11.3",
"jquery": "^3.6.1",
"lodash": "^4.17.21",
"next": "^12.3.1",
"next-compose-plugins": "^2.2.1",

View file

@ -13,29 +13,12 @@ import Apply from '../../components/hackathons/grant/apply'
import Zoom from 'react-reveal/Zoom'
/** @jsxImportSource theme-ui */
if (typeof window !== 'undefined') {
window.$ = window.jQuery = require('jquery')
$(document).ready(function () {
// Add smooth scrolling to all links (source: w3schools)
$('a').on('click', function (event) {
if (this.hash !== '') {
event.preventDefault()
var hash = this.hash
$('html, body').animate(
{
scrollTop: $(hash).offset().top
},
800,
function () {
window.location.hash = hash
}
)
}
})
})
}
const styles = `
html {
scroll-behavior: smooth;
}
`
const Requirement = ({ title, children, checkmark, background, size }) => {
return (
@ -84,6 +67,7 @@ const HackathonGrant = () => {
description="Hack Club is partnering with FIRST to provide $500 grants to in-person high school hackathons happening until June 30th, 2023."
image="https://cloud-7yw9f6xnv-hack-club-bot.vercel.app/0grant.png"
/>
<style>{styles}</style>
<Box as="main" key="main">
<Nav dark />
<ForceTheme theme="dark" />

View file

@ -3082,11 +3082,6 @@ isstream@~0.1.2:
resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
jquery@^3.6.1:
version "3.6.1"
resolved "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz"
integrity sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==
js-sdsl@^4.1.4:
version "4.1.4"
resolved "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.4.tgz"