Skip to content

Commit 04bf24a

Browse files
committed
feat(CC-batch-5): updated required props
1 parent fb4a2cc commit 04bf24a

7 files changed

Lines changed: 102 additions & 102 deletions

File tree

packages/code-connect/components/EmptyState/EmptyState.figma.tsx

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,64 @@
11
import figma from '@figma/code-connect';
2-
import { EmptyState, EmptyStateBody, Spinner } from '@patternfly/react-core';
3-
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
4-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
5-
import LockIcon from '@patternfly/react-icons/dist/esm/icons/lock-icon';
6-
import CubesIcon from '@patternfly/react-icons/dist/esm/icons/cubes-icon';
7-
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
8-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
2+
import { EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateActions } from '@patternfly/react-core';
93

104
// TODO: FIGMA: Add Empty state footer
115
// TODO: FIGMA: Consolodate empty state examples
6+
// TODO: FIGMA: Add empty state footer
7+
// TODO: FIGMA: Add empty state actions
8+
// TODO: FIGMA: Add empty state icon
9+
// TODO: FIGMA: Add empty state title
10+
// TODO: FIGMA: Add empty state body
11+
// TODO: FIGMA: Add empty state variant
12+
// TODO: FIGMA: Add empty state status
13+
// TODO: FIGMA: Add empty state isLoading
14+
// Based on Code Connect's limitations, this component needs to be overhauled. Using the base component approach present in
15+
// other components would significantly reduce complexity.
1216

1317
figma.connect(
1418
EmptyState,
1519
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=7896-37441',
1620
{
1721
props: {
1822
// string
19-
title: figma.string('Header text'),
2023
body: figma.string('Body text'),
24+
title: figma.string('Header text'),
2125

2226
// enum
27+
icon: figma.enum('Type', {
28+
Default: 'CubesIcon', // placeholder icon
29+
Loading: 'Spinner'
30+
}),
31+
status: figma.enum('Type', {
32+
Custom: 'custom',
33+
Warning: 'warning',
34+
Success: 'success',
35+
Danger: 'danger',
36+
Info: 'info'
37+
}),
2338
variant: figma.enum('Size', {
2439
Basic: undefined,
2540
'Extra small': 'xs',
2641
Small: 'sm',
2742
Large: 'lg',
2843
'Extra large': 'xl'
2944
}),
30-
// "custom" | "warning" | "success" | "danger" | "info"
31-
status: figma.enum('Type', {
32-
Basic: {
33-
icon: CubesIcon,
34-
type: undefined
35-
},
36-
Create: {
37-
icon: PlusCircleIcon,
38-
type: 'custom'
39-
},
40-
'No results': {
41-
icon: SearchIcon,
42-
type: 'custom'
43-
},
44-
Success: {
45-
icon: CheckCircleIcon,
46-
type: 'success'
47-
},
48-
Error: {
49-
icon: ExclamationCircleIcon,
50-
type: 'danger'
51-
},
52-
Permissions: {
53-
icon: LockIcon,
54-
type: undefined
55-
},
56-
Danger: {
57-
icon: Spinner,
58-
type: undefined
59-
}
60-
}),
61-
isLoading: figma.enum('Type', { Loading: 'Spinner' })
45+
46+
// children
47+
actions: figma.children(['Button', 'Link Button'])
6248
},
6349
example: (props) => (
6450
// Documentation for EmptyState can be found at https://www.patternfly.org/components/empty-state
6551
<EmptyState
66-
status={props.status.type}
67-
titleText={props.title}
68-
variant={props.variant}
6952
headingLevel="h4"
70-
icon={props.status.icon}
53+
icon={props.icon as any}
54+
variant={props.variant}
55+
status={props.status}
56+
titleText={props.title}
7157
>
7258
<EmptyStateBody>{props.body}</EmptyStateBody>
73-
{/* <EmptyStateFooter>{props.children}</EmptyStateFooter> */}
59+
<EmptyStateFooter>
60+
<EmptyStateActions>{props.actions}</EmptyStateActions>
61+
</EmptyStateFooter>
7462
</EmptyState>
7563
)
7664
}

packages/code-connect/components/ExpandableSection/ExandableSectionTruncate.figma.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
11
import figma from '@figma/code-connect';
22
import { ExpandableSection } from '@patternfly/react-core';
33

4+
// TODO: FIGMA: Create toggle component
5+
const toggleContent = `
6+
<div>
7+
<span>You can also use icons </span>
8+
<CheckCircleIcon />
9+
<span> or badges </span>
10+
<Badge isRead={true}>4</Badge>
11+
<span> !</span>
12+
</div>
13+
`;
14+
415
figma.connect(
516
ExpandableSection,
617
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=2769-146',
718
{
819
props: {
9-
// string
20+
// enum
21+
isIndented: figma.enum('State', { 'Expanded Indent': true }),
22+
toggleContent: figma.enum('State', { Expanded: toggleContent }),
1023
toggleTextCollapsed: figma.enum('State', { Collapsed: figma.string('Toggle Text More') }),
1124
toggleTextExpanded: figma.enum('State', { Expanded: figma.string('Toggle Text Less') }),
1225

1326
// boolean
14-
isExpanded: figma.enum('State', { Expanded: true }),
15-
propsExpandedContentSectionText: figma.enum('State', {
27+
expandedContentSectionText: figma.enum('State', {
1628
Default: figma.string('Default Truncate Text'),
1729
Expanded: figma.string('Expanded Truncate Text')
1830
}),
19-
20-
// enum
21-
expandedContentSectionText: figma.enum('State', { 'Expanded Truncate': true }),
31+
isExpanded: figma.enum('State', { Expanded: true }),
2232

2333
children: figma.children('*')
2434
},
2535
example: (props) => (
2636
// Documentation for ExpandableSection can be found at https://www.patternfly.org/components/expandable-section
2737
<ExpandableSection
38+
// onToggle={() => {}} // only required if the user wants to be able to have other side effects when opening/closing
39+
// isExpanded={() => {}} // only required if the user wants to be able to have other side effects when opening/closing
40+
isIndented={props.isIndented}
41+
toggleContent={props.toggleContent}
2842
toggleTextCollapsed={props.toggleTextCollapsed}
2943
toggleTextExpanded={props.toggleTextExpanded}
30-
onToggle={() => {}}
3144
variant="truncate"
32-
isExpanded={props.isExpanded}
33-
toggleContent={props.children}
3445
>
3546
{props.expandedContentSectionText}
3647
</ExpandableSection>

packages/code-connect/components/ExpandableSection/ExpandableSection.figma.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import figma from '@figma/code-connect';
22
import { ExpandableSection } from '@patternfly/react-core';
33

4+
// TODO: FIGMA: This component needs to be overhauled. Using the base component approach present in
5+
// other components would significantly reduce complexity.
6+
7+
// TODO: FIGMA:
8+
49
// TODO: FIGMA: Create toggle component
510
const toggleContent = `
611
<div>
@@ -55,7 +60,8 @@ figma.connect(
5560
example: (props) => (
5661
// Documentation for ExpandableSection can be found at https://www.patternfly.org/components/expandable-section
5762
<ExpandableSection
58-
isExpanded={props.isExpanded}
63+
// onToggle={() => {}} // only required if the user wants to be able to have other side effects when opening/closing
64+
// isExpanded={() => {}} // only required if the user wants to be able to have other side effects when opening/closing
5965
isIndented={props.isIndented}
6066
toggleContent={props.toggleContent}
6167
toggleTextCollapsed={props.toggleTextCollapsed}

packages/code-connect/components/ExpandableSection/ExpandableSectionDisclosure.figma.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ figma.connect(
88
props: {
99
// string
1010
expandedContentSectionText: figma.string('Expanded Text'),
11-
toggleTextExpanded: figma.string('Toggle Text Less'),
1211
toggleTextCollapsed: figma.string('Toggle Text More'),
12+
toggleTextExpanded: figma.string('Toggle Text Less'),
1313

1414
// boolean
1515
isIndented: figma.enum('State', {
@@ -29,10 +29,10 @@ figma.connect(
2929
<ExpandableSection
3030
isExpanded={props.isExpanded}
3131
isIndented={props.isIndented}
32+
toggleContent={props.children}
3233
toggleTextCollapsed={props.toggleTextCollapsed}
3334
toggleTextExpanded={props.toggleTextExpanded}
3435
variant="truncate"
35-
toggleContent={props.children}
3636
>
3737
{props.expandedContentSectionText}
3838
</ExpandableSection>

packages/code-connect/components/FileUpload/MultipleFileUpload.figma.tsx

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
MultipleFileUploadStatus,
77
MultipleFileUploadStatusItem
88
} from '@patternfly/react-core';
9+
import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
910

1011
// TODO: FIGMA: Add status toggle text
1112
// TODO: FIGMA: Add status toggle icon
@@ -20,42 +21,43 @@ figma.connect(
2021
{
2122
props: {
2223
isHorizontal: figma.enum('Layout', { Horizontal: true }),
23-
24-
state: figma.enum('State', {
25-
Default: 'default',
26-
'Drag over': 'drag-over',
27-
'Uploading + Collapsed': 'uploading---collapsed',
28-
'Uploaded + Collapsed': 'uploaded---collapsed',
29-
'Failed upload + Collapsed': 'failed-upload---collapsed',
30-
'Uploading + Expanded': 'uploading---expanded',
31-
'Uploaded + Expanded': 'uploaded---expanded',
32-
'Failed Upload + Expanded': 'failed-upload---expanded'
33-
}),
34-
35-
statusIcons: ['inProgress', 'success', 'danger']
24+
titleText: 'Drag and drop files here',
25+
titleTextSeparator: 'or',
26+
infoText: 'Accepted file types: JPEG, Doc, PDF, PNG',
27+
children: figma.children('*')
3628
},
3729
example: (props) => (
3830
// Documentation for FileUpload can be found at https://www.patternfly.org/components/file-upload
39-
<MultipleFileUpload onFileDrop={() => {}} isHorizontal={props.isHorizontal}>
31+
<MultipleFileUpload
32+
isHorizontal={props.isHorizontal}
33+
onFileDrop={() => {}}
34+
dropzoneProps={{
35+
accept: {
36+
'image/jpeg': ['.jpg', '.jpeg'],
37+
'application/msword': ['.doc'],
38+
'application/pdf': ['.pdf'],
39+
'image/png': ['.png']
40+
}
41+
}}
42+
>
4043
<MultipleFileUploadMain
41-
titleIcon={'<UploadIcon />'}
42-
titleText="Drag and drop files here"
43-
titleTextSeparator="or"
44-
infoText="Accepted file types: JPEG, Doc, PDF, PNG"
44+
titleIcon={<UploadIcon />}
45+
titleText={props.titleText}
46+
titleTextSeparator={props.titleTextSeparator}
47+
infoText={props.infoText}
4548
/>
4649

4750
<MultipleFileUploadStatus
48-
statusToggleText={'${successfullyReadFileCount} of ${currentFiles.length} files uploaded'}
49-
statusToggleIcon={'statusIcon'}
51+
statusToggleText="Status toggle text"
52+
statusToggleIcon="StatusToggleIcon"
5053
aria-label="Current uploads"
5154
>
5255
<MultipleFileUploadStatusItem
53-
file={file}
54-
key={file.name}
56+
file="file-upload-file"
57+
key="file-upload-key"
5558
onClearClick={() => {}}
5659
onReadSuccess={() => {}}
5760
onReadFail={() => {}}
58-
progressHelperText={'${file.name} is being read'}
5961
/>
6062
</MultipleFileUploadStatus>
6163
</MultipleFileUpload>

packages/code-connect/components/FileUpload/SimpleFileUpload.figma.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,22 @@ figma.connect(
2323
<HelperTextItem id="helper-text-example-helpText">Upload a CSV file</HelperTextItem>
2424
</HelperText>
2525
</FileUploadHelperText>
26-
)
26+
),
27+
false: undefined
2728
}),
2829

2930
// enum
30-
allowEditingUploadedText: figma.enum('State', {
31-
'Uploaded + Not Editable': false,
32-
'Uploaded + Editable': true
33-
}),
31+
allowEditingUploadedText: figma.enum('State', { 'Uploaded + Editable': true }),
3432
isDragActive: figma.enum('State', {
3533
'Drag state': true,
3634
false: undefined
3735
}),
38-
isLoading: figma.enum('State', { 'In progress upload': true })
36+
isLoading: figma.enum('State', { 'In progress upload': true }),
37+
isValidated: figma.enum('State', {
38+
'Invalid upload': 'error',
39+
'Uploaded + Editable': 'success',
40+
'Uploaded + Not Editable': 'success'
41+
})
3942
},
4043
example: (props) => (
4144
// Documentation for FileUpload can be found at https://www.patternfly.org/components/file-upload
@@ -45,6 +48,7 @@ figma.connect(
4548
aria-label="File upload example"
4649
browseButtonText="Upload"
4750
isLoading={props.isLoading}
51+
validated={props.isValidated}
4852
isDragActive={props.isDragActive}
4953
hideDefaultPreview={props.hideDefaultPreview}
5054
allowEditingUploadedText={props.allowEditingUploadedText}

packages/code-connect/components/Hint/Hint.figma.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import {
77
DropdownList,
88
Dropdown,
99
DropdownItem,
10-
Divider,
11-
MenuToggle
10+
Divider
1211
} from '@patternfly/react-core';
13-
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
1412

1513
// TODO: FIGMA: Use dropdown from figma for actions
1614
// TODO: FIGMA: Create hint title
@@ -22,19 +20,10 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
2220

2321
const actions = (
2422
<Dropdown
25-
isOpen={isOpen}
26-
onSelect={onSelect}
27-
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
28-
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
29-
<MenuToggle
30-
ref={toggleRef}
31-
aria-label="Without title example kebab toggle"
32-
variant="plain"
33-
onClick={onToggle}
34-
isExpanded={isOpen}
35-
icon={<EllipsisVIcon />}
36-
/>
37-
)}
23+
isOpen={false} // should use an 'isOpen' state variable
24+
onSelect={() => {}} // need to define an onSelect handler
25+
onOpenChange={() => {}}
26+
toggle={() => {}}
3827
>
3928
<DropdownList>
4029
<DropdownItem value={0} key="action">

0 commit comments

Comments
 (0)