const getScrollbarWidth = () => {
// Creating invisible container
const outer = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.overflow = "scroll"; // forcing scrollbar to appear
document.body.appendChild(outer);
// Creating inner element and placing it in the container
const inner = document.createElement("div");
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
const _grid: T[][] = Array(cols).fill([]); // X (Each index value has same memory address) | |
const _grid: T[][] = Array.from({ length: cols }, () => []); // OK | |
const _grid: T[][] = Array(cols).fill(undefined).map(() => []); // OK |
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
p { | |
display: -webkit-box; | |
overflow: hidden; | |
-webkit-box-orient: vertical; | |
-webkit-line-clamp: 3; | |
} |
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 { useEffect } from 'react'; | |
const useScrollWatcher = () => { | |
useEffect(() => { | |
let timer: number; | |
const handler = (e: Event) => { | |
timer && clearTimeout(timer); | |
document.body.classList.add('scrollShow'); | |
timer = window.setTimeout(() => { | |
document.body.classList.remove('scrollShow'); |
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 { RefObject, useEffect, useState } from 'react'; | |
const useDetectTextLine = (target: RefObject<HTMLElement>) => { | |
const [line, setLine] = useState<number>(); | |
useEffect(() => { | |
const el = target.current; | |
if (!el) return; | |
const observer = new ResizeObserver((entries) => { | |
entries.forEach((entry) => { |
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
html, | |
body, | |
#root { | |
width: 100%; | |
height: 100%; | |
} | |
* { | |
&::-webkit-scrollbar { | |
width: 12px; |
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
* { | |
&::-webkit-scrollbar { | |
width: 12px; | |
background:red; | |
} | |
&::-webkit-scrollbar-thumb { | |
background:blue; | |
border-radius: 18px; | |
border: 2px solid transparent; |
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 { create } from "zustand"; | |
import { createJSONStorage, devtools, persist } from "zustand/middleware"; | |
import { immer } from "zustand/middleware/immer"; | |
type State = { | |
lastAccessTime: number; | |
}; | |
type Actions = { | |
setLastAccessTime: (timestamp: number) => void; |
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 { create } from "zustand"; | |
import { devtools } from "zustand/middleware"; | |
import { immer } from "zustand/middleware/immer"; | |
type State = { | |
isDarkMode: boolean; | |
}; | |
type Actions = { | |
toggleDarkMode: () => void; |
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
🌞 Morning 106 commits █▋░░░░░░░░░░░░░░░░░░░ 8.1% | |
🌆 Daytime 350 commits █████▌░░░░░░░░░░░░░░░ 26.8% | |
🌃 Evening 393 commits ██████▎░░░░░░░░░░░░░░ 30.0% | |
🌙 Night 459 commits ███████▎░░░░░░░░░░░░░ 35.1% |