-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from omnifed/259-feature-input-code-connect-t…
…o-figma 259 feature input code connect to figma
- Loading branch information
Showing
13 changed files
with
340 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import figma from '@figma/code-connect' | ||
import { FieldMessage } from '@cerberus-design/react' | ||
|
||
const SELECTION = | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9266-1663&m=dev' | ||
|
||
const imports = ["import { FieldMessage } from '@cerberus/react'"] | ||
|
||
const props = { | ||
text: figma.textContent('Text'), | ||
} | ||
|
||
figma.connect(FieldMessage, SELECTION, { | ||
imports, | ||
props, | ||
example: (props) => { | ||
return <FieldMessage id="help:ADD_INPUT_ID">{props.text}</FieldMessage> | ||
}, | ||
}) |
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,21 @@ | ||
import figma from '@figma/code-connect' | ||
import { Add } from '@cerberus-design/icons' | ||
|
||
figma.connect( | ||
Add, | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9261-475&m=dev', | ||
|
||
{ | ||
imports: ["import { Add } from '@cerberus/icons'"], | ||
props: { | ||
size: figma.enum('Size', { | ||
sm: 16, | ||
md: 20, | ||
lg: 24, | ||
xl: 32, | ||
}), | ||
}, | ||
|
||
example: (props) => <Add size={props.size} />, | ||
}, | ||
) |
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,21 @@ | ||
import figma from '@figma/code-connect' | ||
import { ArrowDown } from '@cerberus-design/icons' | ||
|
||
figma.connect( | ||
ArrowDown, | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9266-1144&m=dev', | ||
|
||
{ | ||
imports: ["import { ArrowDown } from '@cerberus/icons'"], | ||
props: { | ||
size: figma.enum('Size', { | ||
sm: 16, | ||
md: 20, | ||
lg: 24, | ||
xl: 32, | ||
}), | ||
}, | ||
|
||
example: (props) => <ArrowDown size={props.size} />, | ||
}, | ||
) |
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,21 @@ | ||
import figma from '@figma/code-connect' | ||
import { InformationFilled } from '@cerberus-design/icons' | ||
|
||
figma.connect( | ||
InformationFilled, | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9266-591&m=dev', | ||
|
||
{ | ||
imports: ["import { InformationFilled } from '@cerberus/icons'"], | ||
props: { | ||
size: figma.enum('Size', { | ||
sm: 16, | ||
md: 20, | ||
lg: 24, | ||
xl: 32, | ||
}), | ||
}, | ||
|
||
example: (props) => <InformationFilled size={props.size} />, | ||
}, | ||
) |
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,21 @@ | ||
import figma from '@figma/code-connect' | ||
import { Information } from '@cerberus-design/icons' | ||
|
||
figma.connect( | ||
Information, | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9266-590&m=dev', | ||
|
||
{ | ||
imports: ["import { Information } from '@cerberus/icons'"], | ||
props: { | ||
size: figma.enum('Size', { | ||
sm: 16, | ||
md: 20, | ||
lg: 24, | ||
xl: 32, | ||
}), | ||
}, | ||
|
||
example: (props) => <Information size={props.size} />, | ||
}, | ||
) |
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,107 @@ | ||
import figma from '@figma/code-connect' | ||
import { Input, Field } from '@cerberus-design/react' | ||
|
||
const SELECTION = | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=408-283&m=dev' | ||
|
||
const imports = ["import { Field, Input } from '@cerberus/react'"] | ||
|
||
const props = { | ||
size: figma.enum('Size', { | ||
sm: 'sm', | ||
md: 'md', | ||
lg: 'lg', | ||
}), | ||
// Figma specific | ||
state: figma.enum('State', { | ||
valid: 'valid', | ||
invalid: 'invalid', | ||
warning: 'warning', | ||
disabled: 'disabled', | ||
}), | ||
label: figma.instance('Label'), | ||
fieldMessage: figma.instance('FieldMessage'), | ||
placeholder: figma.textContent('placeholder-text'), | ||
} | ||
|
||
figma.connect(Input, SELECTION, { | ||
imports, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Field> | ||
{props.label} | ||
<Input id="ADD_UUID" placeholder={props.placeholder} /> | ||
{props.fieldMessage} | ||
</Field> | ||
) | ||
}, | ||
}) | ||
|
||
figma.connect(Input, SELECTION, { | ||
imports, | ||
variant: { | ||
State: 'valid', | ||
}, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Field> | ||
{props.label} | ||
<Input id="ADD_UUID" placeholder={props.placeholder} /> | ||
{props.fieldMessage} | ||
</Field> | ||
) | ||
}, | ||
}) | ||
|
||
figma.connect(Input, SELECTION, { | ||
imports, | ||
variant: { | ||
State: 'invalid', | ||
}, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Field invalid> | ||
{props.label} | ||
<Input id="ADD_UUID" placeholder={props.placeholder} /> | ||
{props.fieldMessage} | ||
</Field> | ||
) | ||
}, | ||
}) | ||
|
||
figma.connect(Input, SELECTION, { | ||
imports, | ||
variant: { | ||
State: 'disabled', | ||
}, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Field disabled> | ||
{props.label} | ||
<Input id="ADD_UUID" placeholder={props.placeholder} /> | ||
{props.fieldMessage} | ||
</Field> | ||
) | ||
}, | ||
}) | ||
|
||
figma.connect(Input, SELECTION, { | ||
imports, | ||
variant: { | ||
required: 'True', | ||
}, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Field required> | ||
{props.label} | ||
<Input id="ADD_UUID" placeholder={props.placeholder} /> | ||
{props.fieldMessage} | ||
</Field> | ||
) | ||
}, | ||
}) |
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,40 @@ | ||
import figma from '@figma/code-connect' | ||
import { Label } from '@cerberus-design/react' | ||
|
||
const SELECTION = | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=9225-4221&m=dev' | ||
|
||
const imports = ["import { Label } from '@cerberus/react'"] | ||
|
||
const props = { | ||
state: figma.enum('State', { | ||
required: 'required', | ||
optional: 'optional', | ||
disabled: 'disabled', | ||
hidden: 'hidden', | ||
}), | ||
text: figma.textContent('text'), | ||
} | ||
|
||
figma.connect(Label, SELECTION, { | ||
imports, | ||
props, | ||
example: (props) => { | ||
return <Label htmlFor="ADD_INPUT_ID">{props.text}</Label> | ||
}, | ||
}) | ||
|
||
figma.connect(Label, SELECTION, { | ||
imports, | ||
variant: { | ||
State: 'hidden', | ||
}, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Label htmlFor="ADD_INPUT_ID" hidden> | ||
{props.text} | ||
</Label> | ||
) | ||
}, | ||
}) |
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,56 @@ | ||
import figma from '@figma/code-connect' | ||
import { Tag } from '@cerberus-design/react' | ||
|
||
const SELECTION = | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=7228-19066&m=dev' | ||
|
||
const imports = ["import { Tag } from '@cerberus/react'"] | ||
|
||
const props = { | ||
palette: figma.enum('Palette', { | ||
neutral: 'neutral', | ||
info: 'info', | ||
success: 'success', | ||
warning: 'warning', | ||
danger: 'danger', | ||
}), | ||
shape: figma.enum('Shape', { | ||
pill: 'pill', | ||
rounded: 'rounded', | ||
}), | ||
usage: figma.enum('Usage', { | ||
filled: 'filled', | ||
outlined: 'outline', | ||
}), | ||
// Figma specific | ||
text: figma.textContent('label'), | ||
icon: figma.children('*'), | ||
} | ||
|
||
figma.connect(Tag, SELECTION, { | ||
imports, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Tag palette={props.palette} shape={props.shape} usage={props.usage}> | ||
{props.text} | ||
</Tag> | ||
) | ||
}, | ||
}) | ||
|
||
figma.connect(Tag, SELECTION, { | ||
imports, | ||
variant: { | ||
'show icon': 'True', | ||
}, | ||
props, | ||
example: (props) => { | ||
return ( | ||
<Tag palette={props.palette} shape={props.shape} usage={props.usage}> | ||
{props.icon} | ||
{props.text} | ||
</Tag> | ||
) | ||
}, | ||
}) |
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 figma from '@figma/code-connect' | ||
|
||
const SELECTION = | ||
'https://www.figma.com/design/ducwqOCxoxcWc3ReV3FYd8/Digital-University-Component-Library?node-id=1831-88823&m=dev' | ||
|
||
const props = { | ||
position: figma.enum('Position', { | ||
top: 'top', | ||
right: 'right', | ||
bottom: 'bottom', | ||
left: 'left', | ||
}), | ||
text: figma.textContent('text'), | ||
icon: figma.children('*'), | ||
} | ||
|
||
figma.connect(SELECTION, { | ||
props, | ||
example: (props) => { | ||
return ( | ||
<span aria-label={props.text} data-tooltip data-position={props.position}> | ||
{props.icon} | ||
</span> | ||
) | ||
}, | ||
}) |
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 |
---|---|---|
@@ -1,11 +1,5 @@ | ||
{ | ||
"extends": "../tsconfig.base.json", | ||
"include": ["src/**/*.figma.tsx"], | ||
"exclude": ["build", "node_modules"], | ||
|
||
"compilerOptions": { | ||
"paths": { | ||
"@/*": ["./*"] | ||
} | ||
} | ||
"include": ["src/**/*"], | ||
"exclude": ["build", "node_modules"] | ||
} |