Skip to content

Commit 18d7511

Browse files
committed
code review
1 parent 3b0159e commit 18d7511

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

apps/site/components/Common/CodeBox.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,21 @@ const CodeBox: FC<PropsWithChildren<CodeBoxProps>> = props => {
2121
const [copied, copyToClipboard] = useCopyToClipboard();
2222
const t = useTranslations();
2323

24+
const ButtonIcon = copied ? DocumentDuplicateIcon : CodeBracketIcon;
25+
2426
return (
2527
<BaseCodeBox
2628
as={Link}
2729
onCopy={copyToClipboard}
2830
buttonContent={
29-
copied ? (
30-
<>
31-
<DocumentDuplicateIcon className="size-4" />
32-
{t('components.common.codebox.copied')}
33-
</>
34-
) : (
35-
<>
36-
<CodeBracketIcon className="size-4" />
37-
{t('components.common.codebox.copy')}
38-
</>
39-
)
31+
<>
32+
<ButtonIcon className="size-4" />
33+
{t(
34+
copied
35+
? 'components.common.codebox.copied'
36+
: 'components.common.codebox.copy'
37+
)}
38+
</>
4039
}
4140
{...props}
4241
/>

packages/ui-components/src/Common/BaseCodeBox/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ type CodeBoxProps = {
6969
onCopy: (text: string) => void;
7070
as?: LinkLike;
7171
buttonContent: ReactNode;
72-
copied?: boolean;
7372
};
7473

7574
const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({

pnpm-lock.yaml

Lines changed: 14 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)