-
Notifications
You must be signed in to change notification settings - Fork 4
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
File picker component #50
Conversation
…d remove them, etc., but it's still pretty crude at the moment.
… shorthand which we haven't configured and causes errors. So using 9.0.4 for the time being.
… and the native open dialog appears to work better and in a more straight forward way without trying to label click handling too. Turns out label click is still working in local env anyway.
…e file dialog. In this case do not overwrite the files state with empty
…library/react since RTL is used in bigmaven already and has advantages, especially since the file picker is an uncontrolled component essentially.
"react-ga": "^2.5.6", | ||
"react-styleguidist": "^8.0.6", | ||
"react-styleguidist": "9.0.4", | ||
"react-test-renderer": "^16.9.0", |
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.
Upgraded some of these libraries to be compatible with React Hooks:
enzymejs/enzyme#1938
@@ -64,19 +65,20 @@ | |||
"jest": "^23.6.0", | |||
"postcss-loader": "^3.0.0", | |||
"postcss-preset-env": "^6.5.0", | |||
"react": "^16.7.0", | |||
"react-dom": "^16.7.0", | |||
"react": "^16.9.0", |
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.
React Hooks support started in 16.8 and also we might as well keep up (bigmaven is already using hooks for example!)
@@ -48,14 +48,15 @@ | |||
"@babel/polyfill": "^7.4.4", | |||
"@babel/preset-env": "^7.2.3", | |||
"@babel/preset-react": "^7.0.0", | |||
"@testing-library/react": "^9.1.1", |
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.
Kent Dodds popular testing framework:
https://testing-library.com/docs/react-testing-library/intro
We're using this in bigmaven already and it's got some things that make it easier to test uncontrolled components too.
…tion which returns a string containing the errors. It will use that to set the display errors. Refactors specs and markdown examples accordingly.
Error handling using a |
… dialog, or, drop files onto the dropzone"
…sn't open on hitting the <Enter> key).
src/components/file-picker/.eslintrc
Outdated
@@ -0,0 +1,14 @@ | |||
{ |
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.
I think we can define the overrides in the top-level eslintrc with a files regex.
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.
Done in 68ee789
}; | ||
|
||
const onDragLeave = () => { | ||
setHighlight(false); |
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.
We are missing setHighlight(true)
in this PR.
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.
Fixed in e4404e6
if (files.length) { | ||
return files.map((file) => { | ||
return ( | ||
<section className={styles['file-list-button']} key={file.name}> |
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.
Let's convert this list of <section>
s into a list of <li>
s
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.
Fixed in: 07b8b2f
…stom forms env, I was getting errors like: Module not found: Error: Can't resolve '../icon/icon' and it looks like in other places we're supplying extension. So, trying that.
…guring host applications
@juanca since you'll be taking this over, hopefully this is some good context... The following screenshots show 1. validation errors are working for files > 10mb 2. our file list appears properly above the dropzone upon selecting files 2. our callbacks are both working (Both What will need to be done next?I believe, if I'm understanding correctly, that the code in Search for But I think this proves the component works as advertised and can live in the custom forms env successfully. Here's the latest commit for the Project-and-Task-Forms POC these screenshots refer to. |
Some notes for posterity on commit: 69af234 I tried to fix following error on the Icon component page:
Looks like this was a recent issue for styleguidist and so I followed directions on the issue attempting to nuke the lock file and reinstall: But the error didn't go away. So, I tried following the other suggestion to add acorn et al as dev dep:
And that worked and the error went away. |
Type of work: bug / component / site / accessibility / other
Deployment URL: https://mavenlink.github.io/design-system/$BRANCH
(Optional for outside contributions) Tracked work in Mavenlink:
Motivation
As we are fleshing out the Custom Forms proof-of-concept, we need an input which can attach a file to a form. While the reusability of this particular component is low, it will serve to bring the project to completion. Perhaps this component might actually be used in Mavenlink designs or perhaps this is a component that should live in the mavenlink-solutions/project-and-task-forms repository.
Related long-term MDS release @ #165775767
Resources: https://sketch.cloud/s/VKakr/a/DDWWg4
Acceptance Criteria
Change log entry