-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement code connect for segmentedControl
- Loading branch information
1 parent
f372a4f
commit c4659ff
Showing
3 changed files
with
69 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
58 changes: 58 additions & 0 deletions
58
packages/react/src/SegmentedControl/SegmentedControl.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,58 @@ | ||
import React from 'react' | ||
import {SegmentedControl} from './SegmentedControl' | ||
import figma from '@figma/code-connect' | ||
|
||
/** | ||
* -- This file was auto-generated by `figma connect create` -- | ||
* `props` includes a mapping from Figma properties and variants to | ||
* suggested values. You should update this to match the props of your | ||
* code component, and update the `example` function to return the | ||
* code example you'd like to see in Figma | ||
*/ | ||
|
||
figma.connect( | ||
SegmentedControl, | ||
'https://www.figma.com/design/GCvY3Qv8czRgZgvl1dG6lp/Primer-Web?node-id=16122-79604&t=LhKEppN9LJfzQQ49-4', | ||
{ | ||
props: { | ||
items: figma.children(['SegmentedControl.Button']), | ||
size: figma.enum('size', { | ||
medium: 'medium', | ||
small: 'small', | ||
}), | ||
}, | ||
example: ({size, items}) => <SegmentedControl size={size}>{items}</SegmentedControl>, | ||
}, | ||
) | ||
|
||
figma.connect( | ||
SegmentedControl.Button, | ||
'https://www.figma.com/design/GCvY3Qv8czRgZgvl1dG6lp/Primer-Web?node-id=16121-61223&m=dev', | ||
{ | ||
props: { | ||
label: figma.string('label'), | ||
selected: figma.enum('state', {selected: true}), | ||
leadingIcon: figma.boolean('leadingIcon?', { | ||
true: figma.instance('icon'), | ||
false: undefined, | ||
}), | ||
}, | ||
example: ({selected, label, leadingIcon}) => ( | ||
<SegmentedControl.Button selected={selected} leadingIcon={leadingIcon}> | ||
{label} | ||
</SegmentedControl.Button> | ||
), | ||
}, | ||
) | ||
|
||
figma.connect( | ||
SegmentedControl.IconButton, | ||
'https://www.figma.com/design/GCvY3Qv8czRgZgvl1dG6lp/Primer-Web?node-id=16231-63571&m=dev', | ||
{ | ||
props: { | ||
selected: figma.enum('state', {selected: true}), | ||
leadingIcon: figma.instance('icon'), | ||
}, | ||
example: ({selected, leadingIcon}) => <SegmentedControl.IconButton selected={selected} icon={leadingIcon} />, | ||
}, | ||
) |