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
.sr-only { | |
border: 0; | |
clip: rect(0, 0, 0, 0); | |
height: 1px; | |
margin: -1px; | |
overflow: hidden; | |
padding: 0; | |
position: absolute; | |
white-space: nowrap; | |
width: 1px; |
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
// useDebounce.ts | |
import React from "react"; | |
export default function useDebounce(value: string, delay: number = 500) { | |
const [debouncedValue, setDebouncedValue] = React.useState(value); | |
React.useEffect(() => { | |
const handler: NodeJS.Timeout = setTimeout(() => { | |
setDebouncedValue(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
// useModal.ts | |
import React from "react"; | |
export const useModal = () => { | |
const [modalIsVisible, setModalIsVisible] = React.useState(false); | |
const toggleModalVisibility = () => setModalIsVisible(!modalIsVisible); | |
return { modalIsVisible, toggleModalVisibility }; | |
}; |
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 { useQuery } from "react-query"; | |
import axios from "axios"; | |
export type QueryResponse = { | |
[key: string]: string | |
}; | |
const getStuff = async ( | |
_: string, // TODO: Figure out what this arg is | |
searchQuery: 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
import fs from "fs"; | |
import path from "path"; | |
import matter from "gray-matter"; | |
import remark from "remark"; | |
import html from "remark-html"; | |
export type Product = { | |
id: string; | |
description: string; | |
price: number; |
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
React.useEffect( () => { | |
const abortCtrl = new AbortController(); | |
fetch( | |
`some_url`, | |
{ | |
method: "get", | |
headers: new Headers( { | |
"Content-Type": "application/json", | |
"Accept": "application/json", |
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
{ | |
"General": { | |
"Code": "AAPL", | |
"Type": "Common Stock", | |
"Name": "Apple Inc", | |
"Exchange": "NASDAQ", | |
"CurrencyCode": "USD", | |
"CurrencyName": "US Dollar", | |
"CurrencySymbol": "$", | |
"CountryName": "USA", |
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, FormEvent } from 'react'; | |
type FormField = { | |
field: string; | |
errorMessage?: string; | |
hasError?: boolean; | |
required?: boolean; | |
value?: boolean | string | string[] | null; | |
}; |
OlderNewer