-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitOrigin-RevId: 067489a67da8c36d85d2d8c4ef8f6c58dd40b181
- Loading branch information
1 parent
16caaa3
commit e58ebc1
Showing
28 changed files
with
481 additions
and
294 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
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
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,8 @@ | ||
import React from 'react' | ||
import figma from '../..' | ||
import { Button } from './TestComponents' | ||
|
||
figma.connect(Button, 'ui/button', { | ||
example: () => <Button>Click me</Button>, | ||
imports: ['import Button from "@ui/Button"', 'import { myHook } from "@ui/hooks"'], | ||
}) |
26 changes: 26 additions & 0 deletions
26
react/src/common/__test__/PropsSpreadWithDestructuring.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,26 @@ | ||
import React from 'react' | ||
import figma from '../..' | ||
import { Button } from './PropsSpread' | ||
|
||
const props = { | ||
variant: figma.enum('Variant', { | ||
Primary: 'primary', | ||
Destructive: 'destructive', | ||
Inverse: 'inverse', | ||
Success: 'success', | ||
FigJam: 'FigJam', | ||
Secondary: 'secondary', | ||
'Secondary Destruct': 'destructive-secondary', | ||
}), | ||
width: figma.enum('Size', { | ||
Default: 'hug-contents', | ||
Large: undefined, | ||
Wide: 'fit-parent', | ||
}), | ||
disabled: figma.boolean('Disabled'), | ||
} | ||
|
||
figma.connect(Button, 'spreadWithDestructuring', { | ||
props, | ||
example: ({ variant, ...props }) => <Button variant={variant} {...props} />, | ||
}) |
17 changes: 17 additions & 0 deletions
17
react/src/common/__test__/expected_templates/PropsSpreadWithDestructuring.expected_template
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,17 @@ | ||
const figma = require('figma') | ||
|
||
const variant = figma.properties.enum('Variant', { | ||
"Primary": 'primary', | ||
"Destructive": 'destructive', | ||
"Inverse": 'inverse', | ||
"Success": 'success', | ||
"FigJam": 'FigJam', | ||
"Secondary": 'secondary', | ||
"Secondary Destruct": 'destructive-secondary'}) | ||
const width = figma.properties.enum('Size', { | ||
"Default": 'hug-contents', | ||
"Large": undefined, | ||
"Wide": 'fit-parent'}) | ||
const disabled = figma.properties.boolean('Disabled') | ||
|
||
export default figma.tsx`<Button${_fcc_renderReactProp('variant', variant)}${_fcc_renderReactProp('width', width)}${_fcc_renderReactProp('disabled', disabled)}/>` |
Oops, something went wrong.