Skip to content

feat-CC-simple-components #11714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/react-core/codeConnect/components/AboutModal.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { AboutModal } from '@patternfly/react-core/dist/js/components/AboutModal';
import figma from '@figma/code-connect';

figma.connect(
AboutModal,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2879-13973&m=dev',
{
// reserve variables for mapping
// use props for Figma design file properties
props: {
productName: figma.string('Product name'),

// use `Content` ubiquitiously
children: figma.children('*')
},
example: (props) => (
<AboutModal
backgroundImageSrc="/assets/background_image_src.jpg"
brandImageAlt="image alt text"
brandImageSrc="/assets/brand_image_src.jpg"
productName={props.productName}
trademark={'Sample footer trademark text'}
>
{props.children}
</AboutModal>
)
}
);
27 changes: 27 additions & 0 deletions packages/react-core/codeConnect/components/Avatar.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Avatar } from 'src/components/Avatar';
import figma from '@figma/code-connect';

/**
* -- This file was auto-generated by Code Connect --
* `props` includes a mapping from Figma properties and variants to
* suggested values. You should update this to match the props of your
* code component, and update the `example` function to return the
* code example you'd like to see in Figma
*/

figma.connect(
Avatar,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=1561-4342&m=dev',
{
props: {
isBordered: figma.boolean('Bordered'),
size: figma.enum('Size', {
small: 'sm',
med: 'md',
lg: 'lg',
XL: 'xl'
})
},
example: (props) => <Avatar alt="avatar" {...props} />
}
);
12 changes: 12 additions & 0 deletions packages/react-core/codeConnect/components/BackToTop.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { BackToTop } from '@patternfly/react-core/dist/js/components/BackToTop';
import figma from '@figma/code-connect';

figma.connect(
'https://www.figma.com/design/VMEX8Xg2nzhBX8rfBx53jp/branch/H3LonYnwH26v9zNEa2SXFk/PatternFly-6%3A-Components?node-id=1521-958&m=dev',
{
props: {
title: figma.string('Text')
},
example: (props) => <BackToTop title={props.title} />
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { BackgroundImage } from 'src/components/BackgroundImage';
import figma from '@figma/code-connect';

/**
* -- This file was auto-generated by Code Connect --
* `props` includes a mapping from Figma properties and variants to
* suggested values. You should update this to match the props of your
* code component, and update the `example` function to return the
* code example you'd like to see in Figma
*/

figma.connect(
BackgroundImage,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2722-13543&m=dev',
{
props: {},
example: () => <BackgroundImage src="/assets/images/pf-background.svg" />
}
);
47 changes: 47 additions & 0 deletions packages/react-core/codeConnect/components/Banner.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Banner } from 'src/components/Banner';
import figma from '@figma/code-connect';

/** Status banner example */
figma.connect(
Banner,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=221-937&m=dev',
{
props: {
status: figma.enum('Status', {
Success: 'success',
Warning: 'warning',
Danger: 'danger',
Info: 'info',
Custom: 'custom'
})
},
example: (props) => {
<Banner status={props.status} />;
}
}
);

/** Non-Status banner example */
figma.connect(
Banner,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=221-1443&m=dev',
{
props: {
className: figma.className([]),
color: figma.enum('Color', {
Red: 'red',
Orangered: 'orangered',
Orange: 'orange',
Gold: 'gold',
Green: 'green',
Cyan: 'cyan',
Blue: 'blue',
Purple: 'purple',
Gray: 'gray'
})
},
example: (props) => {
<Banner color={props.color} />;
}
}
);

Check failure on line 47 in packages/react-core/codeConnect/components/Banner.figma.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `⏎`
19 changes: 19 additions & 0 deletions packages/react-core/codeConnect/components/Brand.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Brand } from 'src/components/Brand';
import figma from '@figma/code-connect';

// Masthead logo
figma.connect(
Brand,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2104-3644&m=dev',
{
example: () => <Brand alt="Brand" />
}
);

figma.connect(
Brand,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2104-3689&m=dev',
{
example: () => <Brand alt="Brand" />
}
);
31 changes: 31 additions & 0 deletions packages/react-core/figma.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"codeConnect": {
"parser": "react",
"label": "PF-React",
"include": [
"codeConnect/*.tsx",
"codeConnect/components/*.tsx"
],
"paths": {
"src/components": "src/components"
},
"aliases": {
"@patternfly/react-core": "."
},
"importPaths": {
"src/components": "src/components"
},
"options": {
"instanceSwapper": {
"enabled": true
},
"development": {
"enabled": true,
"verbose": true
},
"production": {
"enabled": false
}
}
}
}
Loading