fix: resolve type errors and lint components/routes

This commit is contained in:
Aarnav Tale 2025-01-06 08:18:46 +05:30
parent 414b95c293
commit 6745ee8529
No known key found for this signature in database
13 changed files with 63 additions and 28 deletions

View file

@ -1,4 +1,4 @@
import { useState, type HTMLProps } from 'react';
import { useState, HTMLProps } from 'react';
import { CopyIcon, CheckIcon } from '@primer/octicons-react';
import { cn } from '~/utils/cn';
import { toast } from '~/components/Toaster';
@ -20,7 +20,7 @@ export default function Code(props: Props) {
>
{props.children}
</code>
{props.isCopyable && props.children ? (
{props.isCopyable ? (
<button
className={cn(
'ml-1 p-1 rounded-md',
@ -29,6 +29,10 @@ export default function Code(props: Props) {
'inline-flex items-center justify-center',
)}
onClick={() => {
if (!props.children) {
throw new Error('Made copyable without children');
}
navigator.clipboard.writeText(props.children.join(''));
toast('Copied to clipboard');
setIsCopied(true);