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 } from 'react'; | |
| export const useBoolean = (defaultValue = false) => { | |
| const [value, setValue] = useState(defaultValue); | |
| const setFalse = () => setValue(false); | |
| const setTrue = () => setValue(true); | |
| const toggle = (flag?: boolean) => setValue((prev) => flag ?? !prev); | |
| return [value, { setFalse, setTrue, toggle }] as const; |
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 * as React from 'react' | |
| type LoaderProps = { | |
| label?: string | |
| animationIteration?: number | |
| animationDelay?: number | |
| stayOnLabelFor?: number | |
| loopAnimation?: boolean | |
| } |
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 { Callback, ClientOpts, createClient, RedisClient } from "redis"; | |
| class RedisConnector { | |
| private client: RedisClient; | |
| private expirationTime = 3600; | |
| static instance: RedisConnector = new RedisConnector(); | |
| private constructor(useTLS = process.env.REDIS_TLS) { | |
| const options: ClientOpts = { | |
| host: process.env.REDIS_URL, |
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 { useMediaQuery, useTheme } from '@material-ui/core'; | |
| type Devices = 'mobile' | 'tablet' | 'desktop'; | |
| type DeviceKey = `is${Capitalize<Devices>}`; | |
| export const useBreakpoints = (): Record<DeviceKey, boolean> => { | |
| const theme = useTheme(); | |
| return { | |
| isMobile: useMediaQuery(theme.breakpoints.down('sm')), |