Skip to content

Commit 67dd45c

Browse files
feat: add button figma
1 parent 382c6af commit 67dd45c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React from 'react'
2+
import figma from '@figma/code-connect'
3+
import {Button, ButtonPrimary, ButtonSecondary, ButtonOutline, ButtonTransparent} from 'rn-base-component'
4+
5+
const BUTTON_FIGMA_URL = '<FIGMA_BUTTON>'
6+
const buttonProps = {
7+
disabled: figma.enum('state', {
8+
disabled: true,
9+
}),
10+
leftIcon: figma.boolean('leading_icon', {
11+
true: figma.boolean('is_icon_only', {
12+
true: undefined,
13+
false: figma.instance('leading_icon_swap'),
14+
}),
15+
false: undefined,
16+
}),
17+
rightIcon: figma.boolean('trailing_icon', {
18+
true: figma.boolean('is_icon_only', {
19+
true: undefined,
20+
false: figma.instance('trailing_icon_swap'),
21+
}),
22+
false: undefined,
23+
}),
24+
children: figma.boolean('is_icon_only', {
25+
true: figma.instance('icon_swap'),
26+
false: figma.string('button_text'),
27+
}),
28+
}
29+
30+
figma.connect(ButtonPrimary, BUTTON_FIGMA_URL, {
31+
variant: {type: 'contained', hierarchy: 'primary'},
32+
props: buttonProps,
33+
example: props => <ButtonPrimary {...props} />,
34+
})
35+
36+
figma.connect(ButtonSecondary, BUTTON_FIGMA_URL, {
37+
variant: {type: 'contained', hierarchy: 'tertiary'},
38+
props: buttonProps,
39+
example: props => <ButtonSecondary {...props} />,
40+
})
41+
42+
figma.connect(ButtonOutline, BUTTON_FIGMA_URL, {
43+
variant: {type: 'outlined'},
44+
props: buttonProps,
45+
example: props => <ButtonOutline {...props} />,
46+
})
47+
48+
figma.connect(ButtonTransparent, BUTTON_FIGMA_URL, {
49+
variant: {type: 'ghost'},
50+
props: buttonProps,
51+
example: props => <ButtonTransparent {...props} />,
52+
})
53+
54+
figma.connect(Button, BUTTON_FIGMA_URL, {
55+
variant: {type: 'link'},
56+
props: buttonProps,
57+
example: props => <Button {...props} />,
58+
})

0 commit comments

Comments
 (0)