This file contains hidden or 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 { useEffect, useState } from 'react' | |
export const useDebounce = (value, delay) => { | |
const [debounced, setDebounced] = useState(value) | |
useEffect(() => { | |
const handler = setTimeout(() => setDebounced(value), delay) | |
return () => clearTimeout(handler) | |
}, [value, delay]) |
This file contains hidden or 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
function type(value) { | |
var regex = /^\[object (\S+?)\]$/; | |
var matches = Object.prototype.toString.call(value).match(regex) || []; | |
return (matches[1] || 'undefined').toLowerCase(); | |
} |
This file contains hidden or 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
const rewireLess = require('react-app-rewire-less'); | |
module.exports = function override(config, env) { | |
config = rewireLess.withLoaderOptions({ | |
javascriptEnabled: true, | |
})(config, env); | |
return config; | |
}; |
This file contains hidden or 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
$(window).on("scroll", function() { | |
var fromTop = $(document).scrollTop(); | |
if (docPos > fromTop) { | |
$body.toggleClass("header-fix", fromTop > 20); | |
} else { | |
$body.removeClass("header-fix"); | |
} | |
if (fromTop > 105) { |
NewerOlder