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
https://www.kmsh.al/namaz/ |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"outDir": "dist", | |
"sourceMap": true, | |
"target": "esnext", | |
"module": "commonjs", | |
"esModuleInterop": true, | |
"forceConsistentCasingInFileNames": true, | |
"noImplicitAny": true, | |
"strict": true, |
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 Link from "next/link"; | |
import { useRouter } from "next/router"; | |
function Page({ content }) { | |
const router = useRouter(); | |
console.log(router); | |
return ( | |
<div className="container"> |
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 debouncedSearch = useRef( | |
debounce((text) => { | |
setNameQuery(text); | |
}, 300), | |
).current; | |
async function onSearch(e: React.ChangeEvent<HTMLInputElement>) { | |
const val = e.target.value; | |
if (val.trim().length > 0) { |
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 { useState, useEffect } from 'react' | |
export default function useReadingTime(ref, wordsPerMinute = 260) { | |
const [wordsCount, setWordsCount] = useState(1) | |
useEffect(() => { | |
const elem = ref.current | |
const words = elem.innerText.match(/\w+/g).length | |
setWordsCount(words) | |
}, [ref]) |
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 { useState, useEffect } from "react"; | |
const useMediaQuery = (query: string) => { | |
const [matches, setMatches] = useState(false); | |
useEffect(() => { | |
const media = window.matchMedia(query); | |
if (media.matches !== matches) { | |
setMatches(media.matches); | |
} |
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 function useLocalStorage<T>(key: string, initialValue: T | (() => T[])) { | |
const [value, setValue] = useState<T>(() => { | |
const jsonValue = localStorage.getItem(key); | |
if (jsonValue != null) return JSON.parse(jsonValue); | |
if (typeof initialValue === 'function') { | |
return (initialValue as () => T)(); |
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
// Thanks @twholman! | |
export default function GitHubCorner() { | |
return ( | |
<a | |
href="https://github.com/sanity-io/example-frontend-next-js" | |
className="github-corner" | |
aria-label="View source on Github" | |
title="View source on Github" | |
> |