Skip to content
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

feat: add useFileInput hook #624

Merged
merged 4 commits into from
Apr 14, 2023
Merged

feat: add useFileInput hook #624

merged 4 commits into from
Apr 14, 2023

Conversation

korvin89
Copy link
Contributor

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@@ -0,0 +1,21 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Filename is Select.stories.tsx

);

return {
controlProps: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's memo this object?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do it?

};
```
*/
export function useFileInput({ref, onUpdate, onChange}: UseFileInputProps): UseFileInputOutput {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better to return the ref from the hook?

);

return {
controlProps: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do it?

style: {opacity: 0, position: 'absolute', width: 1, height: 1},
onChange: handleChange,
},
openDeviceStorage,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make like with controlProps:

Suggested change
openDeviceStorage,
triggerProps: {
onClick: openDeviceStorage,
},

@korvin89 korvin89 merged commit eb47759 into main Apr 14, 2023
@korvin89 korvin89 deleted the add-use-file-input-hook branch April 14, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants