Skip to content

Commit

Permalink
Merge pull request #461 from omnifed/452-docs-code-connect-checkbox
Browse files Browse the repository at this point in the history
feat(figma): code connect checkbox
  • Loading branch information
caseybaggz committed Sep 9, 2024
2 parents 1c1573b + 7af0684 commit 79fb5c6
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 243 deletions.
4 changes: 2 additions & 2 deletions figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"react-dom": "^18"
},
"devDependencies": {
"@figma/code-connect": "^1.0.3",
"@figma/rest-api-spec": "^0.16.0",
"@figma/code-connect": "^1.0.6",
"@figma/rest-api-spec": "^0.17.0",
"@types/react": "^18",
"dotenv": "^16.4.5"
},
Expand Down
2 changes: 1 addition & 1 deletion figma/src/button.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import figma from '@figma/code-connect'
import { Button } from '@cerberus-design/react'

const SELECTION =
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=8637-3339&m=dev'
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=2-8&node-type=FRAME&m=dev'

const imports = ["import { Button } from '@cerberus/react'"]

Expand Down
46 changes: 46 additions & 0 deletions figma/src/checkbox.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import figma from '@figma/code-connect'
import { Checkbox, Field } from '@cerberus-design/react'

const SELECTION =
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9638-138&node-type=FRAME&focus-id=9618-93&m=dev'

const imports = ["import { Field, Checkbox } from '@cerberus/react'"]

const props = {
size: figma.enum('Size', {
md: 'md',
lg: 'lg',
}),
label: figma.children('Label'),
}

figma.connect(Checkbox, SELECTION, {
imports,
props,
example: (props) => {
return (
<Field>
<Checkbox id="ADD_UUID" size={props.size}>
{props.label}
</Checkbox>
</Field>
)
},
})

figma.connect(Checkbox, SELECTION, {
imports,
variant: {
State: 'disabled',
},
props,
example: (props) => {
return (
<Field disabled>
<Checkbox id="ADD_UUID" size={props.size}>
{props.label}
</Checkbox>
</Field>
)
},
})
Loading

0 comments on commit 79fb5c6

Please sign in to comment.