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
| type ComponentMap<Type extends Record<string, unknown>> = { | |
| [Key in keyof Type]: React.FC<Type[Key]>; | |
| }; | |
| type VariantProps<Type extends Record<string, unknown>> = { | |
| [Key in keyof Type]: { type: Key } & Type[Key]; | |
| }[keyof Type]; | |
| type CreateVariantOptions<Type extends Record<string, unknown>> = { | |
| render?: ( |
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
| # Paste this command somewhere in your .zshrc | |
| # ...rest of file | |
| # Load config file if it exists | |
| [[ -f ~/.zsh/git-branch.zsh ]] && source ~/.zsh/git-branch.zsh | |
| # ...rest of file |
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 { useTransform, type MotionValue } from "framer-motion"; | |
| /** | |
| * @see https://www.framer.com/motion/scroll-animations/##parallax | |
| * | |
| * ```tsx | |
| * const Image = ({ id }: { id: number }) => { | |
| * const ref = useRef(null); | |
| * const { scrollYProgress } = useScroll({ target: ref }); | |
| * const y = useParallax(scrollYProgress, 300); |
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
| "use client"; | |
| import { createContext, useEffect, useRef, useState } from "react"; | |
| import { usePathname } from "next/navigation"; | |
| const MAX_HISTORY_LENGTH = 10; | |
| type HistoryObserver = { | |
| history: Array<string>; | |
| referrer?: string; |
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
| @use "styles/includes.module" as *; | |
| .trigger { | |
| cursor: pointer; | |
| } | |
| .content { | |
| display: grid; | |
| grid-template-rows: 0fr; | |
| overflow: hidden; |
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
| @use "styles/includes.module" as *; | |
| :global(::backdrop) { | |
| background: #{rgba(colors.$black, 0.5)}; | |
| } | |
| .root { | |
| --modal-margin: 0.5rem; | |
| min-width: 100%; |
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 { createContext } from "react"; | |
| import { useSafeContext } from "hooks/useSafeContext"; | |
| type RootElem = React.RefObject<HTMLElement>; | |
| const RootElementContext = createContext<RootElem | undefined>(undefined); | |
| RootElementContext.displayName = "RootElementContext"; | |
| type RootElementProviderProps = { |
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 { suppressConsoleLogs } from "test/utils/suppressConsoleLogs"; | |
| import { concurrentFetch } from "./concurrentFetch"; | |
| describe("concurrentFetch", () => { | |
| it( | |
| "should return an array of resolved values", | |
| suppressConsoleLogs(async () => { | |
| const result = await concurrentFetch( | |
| Promise.resolve("value1"), |
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 TIMEOUT_DURATION_MS = 3000; | |
| /** | |
| * Fetches a resource with a timeout. | |
| * | |
| * @param input - The resource to fetch. | |
| * @param init - The options for the fetch. | |
| * @param timeoutDuration - The timeout duration in milliseconds. | |
| * | |
| * @returns A promise that resolves to the response of the fetch. |
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, useRef } from "react"; | |
| /** | |
| * A React hook that returns true if the component is being rendered for the first time. | |
| * | |
| * @returns boolean | |
| * @example | |
| * ```tsx | |
| * import { useIsInitialRender } from "hooks/useIsInitialRender"; | |
| * |
NewerOlder