Skip to content

Commit 58de7f3

Browse files
committed
feat(CC): updated prop mapping
1 parent b664da3 commit 58de7f3

File tree

4 files changed

+48
-58
lines changed

4 files changed

+48
-58
lines changed
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
import { Avatar } from '@patternfly/react-core/dist/js/components/Avatar';
2-
import figma from '@figma/code-connect/react';
1+
import { Avatar } from 'src/components/Avatar';
2+
import figma from '@figma/code-connect';
3+
4+
/**
5+
* -- This file was auto-generated by Code Connect --
6+
* `props` includes a mapping from Figma properties and variants to
7+
* suggested values. You should update this to match the props of your
8+
* code component, and update the `example` function to return the
9+
* code example you'd like to see in Figma
10+
*/
311

412
figma.connect(
513
Avatar,
6-
'https://www.figma.com/design/VMEX8Xg2nzhBX8rfBx53jp/branch/H3LonYnwH26v9zNEa2SXFk/PatternFly-6%3A-Components?node-id=1561-4342&m=dev',
14+
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=1561-4342&m=dev',
715
{
8-
// reserve variables for mapping
9-
// use props for Figma design file properties
1016
props: {
11-
className: figma.className([
12-
// automate size class application
13-
figma.enum('Size', {
14-
XL: 'pf-m-xl',
15-
lg: 'pf-m-lg',
16-
med: 'pf-m-md',
17-
small: 'pf-m-sm'
18-
}),
19-
20-
// automate bordered class application
21-
figma.boolean('Bordered', { true: 'pf-m-bordered', false: '' })
22-
])
17+
isBordered: figma.boolean('Bordered'),
18+
size: figma.enum('Size', {
19+
small: 'sm',
20+
med: 'md',
21+
lg: 'lg',
22+
XL: 'xl'
23+
})
2324
},
24-
example: (props) => <Avatar alt="Avatar image" className={props.className} />
25+
example: (props) => <Avatar alt="avatar" {...props} />
2526
}
2627
);

packages/react-core/codeConnect/components/BackgroundImage.figma.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BackgroundImage } from '@patternfly/react-core/dist/js/components/BackgroundImage';
1+
import { BackgroundImage } from 'src/components/BackgroundImage';
22
import figma from '@figma/code-connect';
33

44
/**
@@ -11,8 +11,9 @@ import figma from '@figma/code-connect';
1111

1212
figma.connect(
1313
BackgroundImage,
14-
'https://www.figma.com/design/VMEX8Xg2nzhBX8rfBx53jp/branch/H3LonYnwH26v9zNEa2SXFk/PatternFly-6%3A-Components?node-id=2722-13543&t=7hKW0DzmfHGhNQnn-11',
14+
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2722-13543&m=dev',
1515
{
16-
example: () => <BackgroundImage {...props} />
16+
props: {},
17+
example: () => <BackgroundImage src="/assets/images/pf-background.svg" />
1718
}
1819
);
Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Banner } from '@patternfly/react-core/dist/js/components/Banner';
1+
import { Banner } from 'src/components/Banner';
22
import figma from '@figma/code-connect';
33

44
/** Status banner example */
@@ -7,19 +7,16 @@ figma.connect(
77
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=221-937&m=dev',
88
{
99
props: {
10-
className: figma.className([
11-
// automate size class application
12-
figma.enum('Status', {
13-
Success: 'success',
14-
Warning: 'warning',
15-
Danger: 'danger',
16-
Info: 'info',
17-
Custom: 'custom'
18-
})
19-
])
10+
status: figma.enum('Status', {
11+
Success: 'success',
12+
Warning: 'warning',
13+
Danger: 'danger',
14+
Info: 'info',
15+
Custom: 'custom'
16+
})
2017
},
2118
example: (props) => {
22-
<Banner className={props.className} />;
19+
<Banner status={props.status} />;
2320
}
2421
}
2522
);
@@ -30,23 +27,21 @@ figma.connect(
3027
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=221-1443&m=dev',
3128
{
3229
props: {
33-
className: figma.className([
34-
// automate size class application
35-
figma.enum('Color', {
36-
Red: 'red',
37-
Orangered: 'orangered',
38-
Orange: 'orange',
39-
Gold: 'gold',
40-
Green: 'green',
41-
Cyan: 'cyan',
42-
Blue: 'blue',
43-
Purple: 'purple',
44-
Gray: 'gray'
45-
})
46-
])
30+
className: figma.className([]),
31+
color: figma.enum('Color', {
32+
Red: 'red',
33+
Orangered: 'orangered',
34+
Orange: 'orange',
35+
Gold: 'gold',
36+
Green: 'green',
37+
Cyan: 'cyan',
38+
Blue: 'blue',
39+
Purple: 'purple',
40+
Gray: 'gray'
41+
})
4742
},
4843
example: (props) => {
49-
<Banner className={props.className} />;
44+
<Banner color={props.color} />;
5045
}
5146
}
52-
);
47+
);

packages/react-core/codeConnect/components/Brand.figma.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Brand } from '@patternfly/react-core/dist/js/components/Brand';
1+
import { Brand } from 'src/components/Brand';
22
import figma from '@figma/code-connect';
33

4+
// Masthead logo
45
figma.connect(
56
Brand,
67
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2104-3644&m=dev',
@@ -9,14 +10,6 @@ figma.connect(
910
}
1011
);
1112

12-
/**
13-
* -- This file was auto-generated by Code Connect --
14-
* `props` includes a mapping from Figma properties and variants to
15-
* suggested values. You should update this to match the props of your
16-
* code component, and update the `example` function to return the
17-
* code example you'd like to see in Figma
18-
*/
19-
2013
figma.connect(
2114
Brand,
2215
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2104-3689&m=dev',

0 commit comments

Comments
 (0)