Skip to content

feat(CC-button): added and validated button #11883

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 2 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
37 changes: 37 additions & 0 deletions packages/code-connect/components/Button/BlockButton.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';

// TODO: DESIGN: Define Icon left/right intent
// Ex: Are the icons different or just on different sides?
// The current configuration renders two icons separately
// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1259-800&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// string
buttonText: figma.string('Text'),

// boolean
hasIcon: figma.boolean('Icon Left', {
true: <PlusCircleIcon />,
false: undefined
}),
iconPosition: figma.boolean('Icon Right', {
true: 'end',
false: undefined
}),

// enum
isDisabled: figma.enum('State', { Disabled: true })
},
example: (props) => (
<Button iconPosition={props.iconPosition} isBlock isDisabled={props.isDisabled} icon={props.hasIcon}>
{props.buttonText}
</Button>
)
}
);
64 changes: 64 additions & 0 deletions packages/code-connect/components/Button/Button.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';

// TODO: DESIGN: Define Icon left/right intent
// Ex: Are the icons different or just on different sides?
// The current configuration renders two icons separately

// TODO: DESIGN: Add count options to the button
// TODO: DESIGN: Add isRead options to the button
// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1259-678',
{
props: {
// string
buttonText: figma.string('Button text'),

// boolean
hasIcon: figma.boolean('Icon left', {
true: <PlusCircleIcon />,
false: undefined
}),
iconPosition: figma.boolean('Icon right', {
true: 'end',
false: undefined
}),

// enum
isDisabled: figma.enum('State', { Disabled: true }),
size: figma.enum('Size', { Small: 'sm' }),
variant: figma.enum('Type', {
Primary: 'primary',
Secondary: 'secondary',
Tertiary: 'tertiary',
Danger: 'danger',
Warning: 'warning'
}),

// Count options - handle logic at props level
countOptions: figma.boolean('Show Count', {
true: {
count: 0,
isRead: false
},
false: undefined
})
},
example: (props) => (
<Button
iconPosition={props.iconPosition}
isDisabled={props.isDisabled}
size={props.size}
variant={props.variant}
countOptions={props.countOptions}
icon={props.hasIcon}
>
{props.buttonText}
</Button>
)
}
);
27 changes: 27 additions & 0 deletions packages/code-connect/components/Button/CTAButton.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';

// Documentation for Button can be found at https://www.patternfly.org/components/button
figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1259-778&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// string
text: figma.string('Text'),

// enum
variant: figma.enum('Type', {
Primary: 'primary',
Secondary: 'secondary',
Tertiary: 'tertiary'
}),
isInline: figma.enum('Type', { Inline: true })
},
example: (props) => (
<Button size="lg" variant={props.variant}>
{props.text}
</Button>
)
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';

// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1259-736&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// enum
isClicked: figma.enum('State', { Clicked: true }),
isDisabled: figma.enum('State', { Disabled: true }),

// variant
hasNoPadding: figma.enum('Type', { 'No padding': true })
},
example: (props) => (
<Button
aria-label="Icon button"
hasNoPadding={props.hasNoPadding}
icon={<TimesIcon />}
isClicked={props.isClicked}
isDisabled={props.isDisabled}
variant="plain"
/>
)
}
);
30 changes: 30 additions & 0 deletions packages/code-connect/components/Button/InlineLink.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';
import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';

// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1291-2153&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// strings
text: figma.string('Text'),

// boolean
hasIcon: figma.enum('Type', {
'Inline link external': <ExternalLinkSquareAltIcon />,
false: undefined
}),

// state
isDisabled: figma.enum('State', { Disabled: true })
},
example: (props) => (
<Button icon={props.hasIcon} isInline isDisabled={props.isDisabled} variant="link">
{props.text}
</Button>
)
}
);
56 changes: 56 additions & 0 deletions packages/code-connect/components/Button/LinkButton.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';

// TODO: DESIGN: Define Icon left/right intent
// Ex: Are the icons different or just on different sides?
// The current configuration renders two icons separately
// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=1259-745&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// string
buttonText: figma.string('Text'),

// boolean
hasIcon: figma.boolean('Icon left', {
true: <PlusCircleIcon />,
false: undefined
}),
iconPosition: figma.boolean('Icon right', {
true: 'end',
false: undefined
}),

// enum
isClicked: figma.enum('State', { Clicked: true }),
isDanger: figma.enum('Type', { Danger: true }),
isDisabled: figma.enum('State', { Disabled: true }),
size: figma.enum('Size', { Small: 'sm' }),

variant: figma.enum('Type', {
Primary: 'primary',
Secondary: 'secondary',
Tertiary: 'tertiary'
}),

children: figma.children('*')
},
example: (props) => (
<Button
icon={props.hasIcon}
isClicked={props.isClicked}
isDanger={props.isDanger}
isDisabled={props.isDisabled}
iconPosition={props.iconPosition}
size={props.size}
variant="link"
>
{props.buttonText}
</Button>
)
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';

// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=3102-7154&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// enum
isClicked: figma.enum('State', { Clicked: true }),
isDisabled: figma.enum('State', { Disabled: true }),
leftOrRight: figma.enum('Left or Right', {
Left: 'left',
Right: 'right'
}),
variant: figma.enum('Type', {
Primary: 'primary',
Secondary: 'secondary',
Tertiary: 'tertiary'
}),

// string
text: figma.string('Text')
},
example: (props) => (
<Button isClicked={props.isClicked} isDisabled={props.isDisabled} variant={props.variant}>
{props.text}
</Button>
)
}
);
37 changes: 37 additions & 0 deletions packages/code-connect/components/Button/StatefulButton.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import figma from '@figma/code-connect';
import { Button } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

// Documentation for Button can be found at https://www.patternfly.org/components/button

figma.connect(
Button,
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=5805-20130&t=TMTA4Fpy1ljK4qQP-11',
{
props: {
// boolean
showIcon: figma.boolean('Show Icon', {
true: <BellIcon />,
false: undefined
}),
showText: figma.boolean('Show text', {
true: figma.string('Text ✏️'),
false: undefined
}),

// enum
state: figma.enum('Type', {
Read: 'read',
Unread: 'unread',
'Unread - Needs attention': 'attention'
}),

children: figma.children('*')
},
example: (props) => (
<Button icon={props.showIcon} state={props.state} variant="stateful">
{props.showText}
</Button>
)
}
);
Loading