Skip to content

Commit ec2315c

Browse files
Refactor icon types and improve copy button error handling
Co-authored-by: rahul.chhabria <[email protected]>
1 parent 26bd050 commit ec2315c

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/@types/radix-ui__react-icons.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
declare module '@radix-ui/react-icons' {
2-
import * as React from 'react';
2+
import type {ForwardRefExoticComponent, SVGProps} from 'react';
33

4-
export interface IconProps extends React.SVGProps<SVGSVGElement> {
5-
width?: number | string;
4+
export interface IconProps extends SVGProps<SVGSVGElement> {
65
height?: number | string;
6+
width?: number | string;
77
}
88

9-
type IconComponent = React.ForwardRefExoticComponent<IconProps>;
9+
type IconComponent = ForwardRefExoticComponent<IconProps>;
1010

1111
export const CopyIcon: IconComponent;
1212
export const CheckIcon: IconComponent;

src/components/copyForLLMButton.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use client";
22

3+
// eslint-disable-next-line simple-import-sort/imports
34
import {useState, useCallback, Fragment} from 'react';
5+
46
import {createPortal} from 'react-dom';
57
import {CopyIcon, CheckIcon} from '@radix-ui/react-icons';
68

@@ -35,8 +37,8 @@ export default function CopyForLLMButton() {
3537
setCopied(false);
3638
setShowToast(false);
3739
}, 2000);
38-
} catch (err) {
39-
console.error('Failed to copy content for LLM', err);
40+
} catch {
41+
/* ignore clipboard errors */
4042
}
4143
}, []);
4244

src/components/docPage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import './type.scss';
1414
import {Banner} from '../banner';
1515
import {Breadcrumbs} from '../breadcrumbs';
1616
import {CodeContextProvider} from '../codeContext';
17+
import CopyForLLMButton from '../copyForLLMButton';
1718
import {DocFeedback} from '../docFeedback';
1819
import {GitHubCTA} from '../githubCTA';
1920
import {Header} from '../header';
@@ -23,7 +24,6 @@ import {PlatformSdkDetail} from '../platformSdkDetail';
2324
import {Sidebar} from '../sidebar';
2425
import {SidebarTableOfContents} from '../sidebarTableOfContents';
2526
import {ReaderDepthTracker} from '../track-reader-depth';
26-
import CopyForLLMButton from '../copyForLLMButton';
2727

2828
type Props = {
2929
children: ReactNode;

0 commit comments

Comments
 (0)