Skip to content

Commit 04e55b3

Browse files
authored
Exports CopyButton from Code component (#2919)
* export copy button * fix
1 parent 1eafbb5 commit 04e55b3

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.changeset/bumpy-dragons-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/code': minor
3+
---
4+
5+
Exports `CopyButton` component

packages/code/src/Code.stories.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import {
1515
languageOptions,
1616
LanguageSwitcherWithPanelExample,
1717
} from './LanguageSwitcher/LanguageSwitcherExample';
18-
import Code, { CodeProps, CopyButtonAppearance, Language, Panel } from '.';
18+
import Code, {
19+
CodeProps,
20+
CopyButton,
21+
CopyButtonAppearance,
22+
Language,
23+
Panel,
24+
} from '.';
1925

2026
const customActionButtons = [
2127
<IconButton onClick={() => {}} aria-label="label" key="1">
@@ -384,3 +390,7 @@ Loading.parameters = {
384390
},
385391
},
386392
};
393+
394+
export const CopyButtonExample = () => {
395+
return <CopyButton contents={jsSnippet} />;
396+
};

packages/code/src/CopyButton/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as CopyButton } from './CopyButton';

packages/code/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Code, CopyButtonAppearance } from './Code';
22
export { Code, CopyButtonAppearance };
33
export type { CodeProps } from './Code/Code.types';
4+
export { CopyButton } from './CopyButton';
45
export { variantColors } from './globalStyles';
56
export { Panel } from './Panel';
67
export type { LanguageOption } from './Panel/Panel.types';
78
export type { SyntaxProps } from './Syntax/Syntax.types';
89
export type { LineHighlightingDefinition } from './types';
910
export { Language } from './types';
1011
export { getLgIds, type GetLgIdsReturnType } from './utils';
11-
1212
export default Code;

0 commit comments

Comments
 (0)