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 ImgWithFallback = ({ | |
src: string, | |
fallback: string, | |
type = 'image/webp', | |
...props | |
}) => { | |
return ( | |
<picture> | |
<source srcSet={src} type={type} /> | |
<img src={fallback} {...props} /> |
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, useRef, useState } from 'react'; | |
interface UseIntervalProps { | |
fn: () => void; | |
interval: number; | |
} | |
interface UseIntervalReturn { | |
active: boolean; | |
start: () => 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 { useState, type TouchEvent } from 'react' | |
interface SwipeInput { | |
onSwipedLeft: () => void | |
onSwipedRight: () => void | |
} | |
interface SwipeOutput { | |
onTouchStart: (e: TouchEvent) => void | |
onTouchMove: (e: TouchEvent) => void |