Skip to content

feat(CC-batch-2): added batch 2 #11828

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 4 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
47 changes: 47 additions & 0 deletions packages/code-connect/components/Alert/InlineAlert.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import figma from '@figma/code-connect';
import { Alert } from '@patternfly/react-core';

/**
* PatternFly Alert component integration for Figma Code Connect
*/

figma.connect(
Alert,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1110-2698&m=dev',
{
props: {
// booleans
description: figma.boolean('Description', {
true: figma.string('✏️ Description'),
false: undefined
}),
hasActions: figma.boolean('Actions'),
isDismissable: figma.boolean('Dismissable'),
isExpandable: figma.boolean('Expandable'),

// strings
title: figma.string('✏️ Title'),

// enums
variant: figma.enum('Type', {
Info: 'info',
Success: 'success',
Warning: 'warning',
Danger: 'danger',
Custom: 'custom'
})
},
example: (props) => (
<Alert
actionClose={props.isDismissable}
actionLinks={props.hasActions}
isExpandable={props.isExpandable}
isInline
title={props.title}
variant={props.variant}
>
{props.description}
</Alert>
)
}
);
18 changes: 18 additions & 0 deletions packages/code-connect/components/Alert/InlineAlertGroup.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import figma from '@figma/code-connect';
import { AlertGroup } from '@patternfly/react-core';

/**
* PatternFly Alert component integration for Figma Code Connect
*/

figma.connect(
AlertGroup,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1110-2780&m=dev',
{
props: {
// children
children: figma.children('*')
},
example: (props) => <AlertGroup>{props.children}</AlertGroup>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These AlertGroups should have isLiveRegion and hasAnimations if they could appear on the page. They don't need these props if they are present on page load and cannot be dismissed.

}
);
32 changes: 32 additions & 0 deletions packages/code-connect/components/Alert/InlinePlainAlert.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import figma from '@figma/code-connect';
import { Alert } from '@patternfly/react-core';

/**
* PatternFly Alert component integration for Figma Code Connect
*/

figma.connect(
Alert,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1110-2754&m=dev',
{
props: {
// strings
title: figma.string('✏️ Title'),

// variants
variant: figma.enum('Type', {
Info: 'info',
Success: 'success',
Warning: 'warning',
Danger: 'danger',
Custom: 'custom'
}),

// children
children: figma.children('*')
},
example: (props) => (
<Alert variant={props.variant} title={props.title} variantLabel={props.variant} isInline isPlain />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need separate code connect files for inline alert & plain inline alert or could these be combined with boolean flags for both isPlain and isInline?

)
}
);
20 changes: 20 additions & 0 deletions packages/code-connect/components/Alert/OverflowFooter.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import figma from '@figma/code-connect';
import { AlertGroup } from '@patternfly/react-core';

/**
* PatternFly Alert component integration for Figma Code Connect
*/

figma.connect(
AlertGroup,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1110-2784&m=dev',
{
props: {
// strings
overflowMessage: figma.string('✏️ Title'),

children: figma.children('*')
},
example: (props) => <AlertGroup overflowMessage={props.overflowMessage}>{props.children}</AlertGroup>
}
);
44 changes: 44 additions & 0 deletions packages/code-connect/components/Alert/ToastAlert.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import figma from '@figma/code-connect';
import { Alert } from '@patternfly/react-core';

/**
* PatternFly Alert component integration for Figma Code Connect
*/

figma.connect(
Alert,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1110-2587&m=dev',
{
props: {
// booleans
actionLinks: figma.boolean('Actions'),
alertDescription: figma.boolean('Description', {
true: figma.string('✏️ Description'),
false: undefined
}),
isExpandable: figma.boolean('Expandable'),

// strings
title: figma.string('✏️ Title'),

// variants
variant: figma.enum('Type', {
Custom: 'custom',
Danger: 'danger',
Info: 'info',
Success: 'success',
Warning: 'warning'
})
},
example: (props) => (
<Alert
title={props.title}
variant={props.variant}
actionLinks={props.actionLinks}
isExpandable={props.isExpandable}
>
{props.alertDescription}
</Alert>
)
}
);
17 changes: 17 additions & 0 deletions packages/code-connect/components/Alert/ToastAlertGroup.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import figma from '@figma/code-connect';
import { AlertGroup } from '@patternfly/react-core';

/**
* PatternFly AlertGroup component integration for Figma Code Connect
*/

figma.connect(
AlertGroup,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1110-2821&m=dev',
{
props: {
children: figma.children('*')
},
example: (props) => <AlertGroup>{props.children}</AlertGroup>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this AlertGroup should have isToast isLiveRegion hasAnimations added to it

}
);
28 changes: 28 additions & 0 deletions packages/code-connect/components/Avatar/Avatar.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import figma from '@figma/code-connect';
import { Avatar } from '@patternfly/react-core';

/**
* PatternFly Avatar component integration for Figma Code Connect
*/

figma.connect(
Avatar,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=1561-4342&m=dev',
{
props: {
// booleans
isBordered: figma.boolean('Bordered'),

// enums
size: figma.enum('Size', {
small: 'sm',
med: 'md',
lg: 'lg',
XL: 'xl'
})
},
example: (props) => (
<Avatar alt="Avatar" src="/assets/images/avatar.svg" isBordered={props.isBordered} size={props.size} />
)
}
);
14 changes: 14 additions & 0 deletions packages/code-connect/components/BackToTop/BackToTop.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { BackToTop } from '@patternfly/react-core';
import figma from '@figma/code-connect';

figma.connect(
BackToTop,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1521-958&m=dev',
{
props: {
// strings
text: figma.string('Text')
},
example: (props) => <BackToTop title={props.text} />
}
);
14 changes: 14 additions & 0 deletions packages/code-connect/components/Backdrop/Backdrop.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import figma from '@figma/code-connect';
import { Backdrop } from '@patternfly/react-core';

/**
* PatternFly Backdrop component integration for Figma Code Connect
*/

figma.connect(
Backdrop,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6%3A-Components-Test?node-id=2873-2900&m=dev',
{
example: () => <Backdrop />
}
);
26 changes: 26 additions & 0 deletions packages/code-connect/components/Badge/Badge.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import figma from '@figma/code-connect';
import { Badge } from '@patternfly/react-core';

/**
* PatternFly Badge component integration for Figma Code Connect
*/

figma.connect(
Badge,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1259-1132&m=dev',
{
props: {
// strings
title: figma.string('Text'),

// enums
isRead: figma.enum('Type', {
Read: true
}),
isDisabled: figma.enum('Type', {
disabled: true
})
},
example: (props) => <Badge title={props.title} isRead={props.isRead} isDisabled={props.isDisabled} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no title prop on Badge. instead you pass the title as children

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may also be worth stubbing out the screenReaderText prop for a11y setup.

}
);
33 changes: 33 additions & 0 deletions packages/code-connect/figma.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"codeConnect": {
"parser": "react",
"include": [
"components/Alert/*.tsx",
"components/Avatar/*.tsx",
"components/Backdrop/*.tsx",
"components/BackToTop/*.tsx",
"components/Badge/*.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