-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d74500
commit ec68b3c
Showing
5 changed files
with
177 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
packages/react/code-connect/CodeSnippet/CodeSnippet.figma.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { CodeSnippet, CodeSnippetSkeleton } from '@carbon/react'; | ||
import figma from '@figma/code-connect'; | ||
|
||
// Inline | ||
figma.connect( | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4266-104904&t=cMvnFTYLPEhzhIpj-4', | ||
{ | ||
example: () => { | ||
return ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<div>{/* To view CodeSnippet code, view inner component */}</div> | ||
); | ||
}, | ||
} | ||
); | ||
|
||
//Inline item | ||
figma.connect( | ||
CodeSnippet, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4266-104960&t=cMvnFTYLPEhzhIpj-4', | ||
{ | ||
props: { | ||
children: figma.string('Code text'), | ||
}, | ||
example: ({ children }) => { | ||
return ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<CodeSnippet type="inline" feedback="Copied to clipboard"> | ||
{children} | ||
</CodeSnippet> | ||
); | ||
}, | ||
} | ||
); | ||
|
||
//Single line | ||
figma.connect( | ||
CodeSnippet, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4266-103999&t=cMvnFTYLPEhzhIpj-4', | ||
{ | ||
example: () => ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<CodeSnippet type="single" feedback="Copied to clipboard"> | ||
yarn add carbon-components@latest carbon-components-react@latest | ||
@carbon/icons-react@latest carbon-icons@latest | ||
</CodeSnippet> | ||
), | ||
} | ||
); | ||
|
||
//Multi line | ||
figma.connect( | ||
CodeSnippet, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4257-168802&t=cMvnFTYLPEhzhIpj-4', | ||
{ | ||
props: { | ||
// numbers: figma.boolean('Numbers'), // not available in code | ||
hideCopyButton: figma.boolean('Copy', { | ||
true: false, | ||
false: true, | ||
}), | ||
expanded: figma.boolean('Expanded'), | ||
}, | ||
example: ({ hideCopyButton }) => ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<CodeSnippet | ||
type="multi" | ||
feedback="Copied to clipboard" | ||
hideCopyButton={hideCopyButton}> | ||
Code sample here | ||
</CodeSnippet> | ||
), | ||
} | ||
); | ||
|
||
// Skeleton state (multiline only) | ||
figma.connect( | ||
CodeSnippetSkeleton, | ||
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4257-168802&t=cMvnFTYLPEhzhIpj-4', | ||
{ | ||
variant: { State: 'Skeleton' }, | ||
example: () => ( | ||
// Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// React is in an exploratory phase. Code sample below may be incomplete. | ||
<CodeSnippetSkeleton type="multi" /> | ||
), | ||
} | ||
); | ||
|
||
// // Skeleton state (multiline only) | ||
// figma.connect( | ||
// CodeSnippetSkeleton, | ||
// 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=4257-168802&t=cMvnFTYLPEhzhIpj-4', | ||
// { | ||
// variant: { State: 'Skeleton' }, | ||
// example: () => { | ||
// return ( | ||
// // Disclaimer: Code Connect is currently in beta and integration with Carbon | ||
// // React is in an exploratory phase. Code sample below may be incomplete. | ||
// <CodeSnippetSkeleton type="multi" /> | ||
// ); | ||
// }, | ||
// } | ||
// ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters