Skip to content

Commit

Permalink
Merge pull request #257 from omnifed/256-feature-test-dynamically-cre…
Browse files Browse the repository at this point in the history
…ating-icon-figma-files

256 feature test dynamically creating icon figma files
  • Loading branch information
caseybaggz committed Jul 9, 2024
2 parents baeef0d + 184074b commit c44ca60
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "The Figma Code Connect config for Cerberus Design",
"scripts": {
"create:icon-sets": "bun run ./scripts/create-icon-sets.ts",
"create:icons": "bun run ./scripts/create-icons.ts",
"figma:publish": "npx figma connect publish",
"figma:sync": "bun run ./scripts/variables/sync-figma.ts",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { client } from '@figma/code-connect'

/**
* This module accepts a Figma Page URL and returns a list of components to
* create a Code Connect file for each component.
*/

async function getIcons() {
try {
const components = await client.getComponents(
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?m=auto&node-id=8828-2234&t=3tgTnJYuDX1IXmLI-1',
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=2-14619&m=dev',
)

console.log({
Expand Down
21 changes: 21 additions & 0 deletions figma/src/icons/close-icon.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import figma from '@figma/code-connect'
import { Close } from '@cerberus-design/icons'

figma.connect(
Close,
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9091-3254&m=dev',

{
imports: ["import { Close } from '@cerberus/icons'"],
props: {
size: figma.enum('Size', {
sm: 16,
md: 20,
lg: 24,
xl: 32,
}),
},

example: (props) => <Close size={props.size} />,
},
)
2 changes: 1 addition & 1 deletion figma/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"include": ["src/*.figma.tsx"],
"include": ["src/**/*.figma.tsx"],
"exclude": ["build", "node_modules"],

"compilerOptions": {
Expand Down

0 comments on commit c44ca60

Please sign in to comment.