-
Notifications
You must be signed in to change notification settings - Fork 49
feat: add file uploader as a fragment component #302
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
👷 Deploy request for carbon-components-builder pending review.Visit the deploys page to approve it
|
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
|
Verified that the component features and export works. |
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
zvonimirfras
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
messy
| acceptedFileFormat: string; | ||
| buttonKind: string; | ||
| buttonLabel: string; | ||
| labelTitle: string; | ||
| filenameStatus: string; | ||
| dragAndDroplabelText: string; | ||
| labelDescription: string; | ||
| iconDescription: string; | ||
| size: string; | ||
| multiple: boolean; | ||
| disabled: boolean; | ||
| dragAndDrop: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of these (maybe all?) should be optional
| ...commonSlots, | ||
| ...slotsDisabled, | ||
| multiple: 'boolean', | ||
| isMultiple: (state: FileUploaderState) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as for time picker
| onChange={(event: any) => { | ||
| sendSignal(state.id, 'valueChange', [event.value], { ...state, value: event.value }); | ||
| }} | ||
| accept={state.acceptedFileFormat.split(',')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like acceptedFileFormat should be acceptedFileFormats and be a list of strings
| buttonLabel: 'string', | ||
| labelTitle: 'string', | ||
| filenameStatus: 'string', | ||
| dragAndDroplabelText: 'string', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something's off about this
| import { Checkbox, Dropdown, TextInput, FileUploaderDropContainer, FileUploader } from '@carbon/react'; | ||
| import { angularClassNamesFromComponentObj, nameStringToVariableString, reactClassNamesFromComponentObj } from '../helpers/tools'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like these would be better split into multiple lines to follow the style in other files
| ...selectedComponent, | ||
| iconDescription: event.currentTarget.value | ||
| })} /> | ||
| </> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something's off with the indentation here
| componentObj.dragAndDrop ? <FileUploaderDropContainer | ||
| className={cx(preventCheckEventStyle, componentObj.cssClasses?.map((cc: any) => cc.id).join(' '))} | ||
| accept={acceptedFileFormat} | ||
| multiple={componentObj.multiple} | ||
| disabled={componentObj.disabled} | ||
| labelText={componentObj.dragAndDroplabelText} | ||
| tabIndex={0} /> : <FileUploader | ||
| className={cx(preventCheckEventStyle, componentObj.cssClasses?.map((cc: any) => cc.id).join(' '))} | ||
| accept={acceptedFileFormat} | ||
| buttonKind={componentObj.buttonKind} | ||
| buttonLabel={componentObj.buttonLabel} | ||
| filenameStatus={componentObj.filenameStatus} | ||
| iconDescription={componentObj.iconDescription} | ||
| labelDescription={componentObj.labelDescription} | ||
| labelTitle={componentObj.labelTitle} | ||
| multiple={componentObj.multiple} | ||
| disabled={componentObj.disabled} | ||
| size={componentObj.size} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be more readable. Follow the style from the rest of the repo (as suggested above)
| [disabled]="${nameStringToVariableString(json.codeContext?.name)}Disabled" | ||
| [size]="${nameStringToVariableString(json.codeContext?.name)}Size" | ||
| [disabled]="${nameStringToVariableString(json.codeContext?.name)}Disabled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabled twice??
| ${json.dragAndDrop ? `[dropText]="${nameStringToVariableString(json.codeContext?.name)}DropText"` : ''} | ||
| ${json.dragAndDrop ? '' : `[buttonText]="${nameStringToVariableString(json.codeContext?.name)}ButtonText"`} | ||
| ${json.dragAndDrop ? '' : `[buttonType]="${nameStringToVariableString(json.codeContext?.name)}ButtonType"`} | ||
| (filesChange)= ${nameStringToVariableString(json.codeContext?.name)}onDropped.emit($event)> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name should be camelCase
| code: ({ json }) => { | ||
| return `<ibm-file-uploader | ||
| ${angularClassNamesFromComponentObj(json)} | ||
| [title]="${nameStringToVariableString(json.codeContext?.name)}Title" | ||
| [description]="${nameStringToVariableString(json.codeContext?.name)}Description" | ||
| [accept]="${nameStringToVariableString(json.codeContext?.name)}Accept" | ||
| [multiple]="${nameStringToVariableString(json.codeContext?.name)}Multiple" | ||
| [disabled]="${nameStringToVariableString(json.codeContext?.name)}Disabled" | ||
| [size]="${nameStringToVariableString(json.codeContext?.name)}Size" | ||
| [disabled]="${nameStringToVariableString(json.codeContext?.name)}Disabled" | ||
| [drop]="${nameStringToVariableString(json.codeContext?.name)}Drop" | ||
| ${json.dragAndDrop ? `[dropText]="${nameStringToVariableString(json.codeContext?.name)}DropText"` : ''} | ||
| ${json.dragAndDrop ? '' : `[buttonText]="${nameStringToVariableString(json.codeContext?.name)}ButtonText"`} | ||
| ${json.dragAndDrop ? '' : `[buttonType]="${nameStringToVariableString(json.codeContext?.name)}ButtonType"`} | ||
| (filesChange)= ${nameStringToVariableString(json.codeContext?.name)}onDropped.emit($event)> | ||
| </ibm-file-uploader>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation + it doesn't need the explicit return statement
for #184