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
export const truncateEthAddress = (address: string) => { | |
const truncateRegex = /^(0x[a-zA-Z0-9]{4})[a-zA-Z0-9]+([a-zA-Z0-9]{4})$/; | |
const match = address.match(truncateRegex); | |
if (!match) return address; | |
return `${match[1]}…${match[2]}`; | |
}; |
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 { GetStaticProps, NextPage } from "next"; | |
interface Data { | |
title: string; | |
} | |
interface HomePageProps { | |
data: Data; | |
} |
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 type { GetStaticPaths, GetStaticProps, NextPage } from "next"; | |
import { ParsedUrlQuery } from "querystring"; | |
interface Data { | |
title: string; | |
} | |
interface HomePageProps { | |
data: Data; | |
} |
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, Fragment } from "react"; | |
import { Transition } from "@headlessui/react"; | |
import * as DialogPrimitive from "@radix-ui/react-dialog"; | |
import * as Portal from "@radix-ui/react-portal"; | |
interface DialogProps { | |
trigger: React.ReactNode; | |
} | |
const Dialog: React.FC<DialogProps> = ({ trigger }) => { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
interface ProgressProps { | |
label?: string; | |
value: number; | |
} | |
const Progress: React.FC<ProgressProps> = ({ label, value }) => { | |
return ( | |
<> | |
{label ? ( | |
<div className="mb-1 flex justify-between"> |
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 useSWR from "swr"; | |
import { fetcher } from "lib/fetch"; | |
const usePrice = (fromCurrencies: string, vsCurrencies: string) => { | |
const { data, error } = useSWR( | |
`https://api.coingecko.com/api/v3/simple/price?ids=${fromCurrencies}&vs_currencies=${vsCurrencies}`, | |
fetcher | |
); | |
return { |
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 SelectDisplayImage = () => { | |
const [image, setImage] = useState<null | string>(null); | |
const onImageChange = (event: React.ChangeEvent<HTMLInputElement>) => { | |
const input = event.target; | |
if (!input.files?.length) { | |
return; | |
} |
OlderNewer