fix: resolve type errors and lint components/routes
This commit is contained in:
parent
414b95c293
commit
6745ee8529
13 changed files with 63 additions and 28 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue