Skip to content

Commit

Permalink
Merge pull request #118 from MapColonies/file_picker_fix
Browse files Browse the repository at this point in the history
fix: fix
  • Loading branch information
EllaMartirosyan authored Feb 13, 2022
2 parents 3f12e71 + c1379ad commit 9978bd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import React, {
useCallback,
Expand Down Expand Up @@ -401,17 +404,17 @@ export const FilesSelection: Story = () => {
);
const fileBrowserRef = useRef<FilePickerHandle>(null);

const getSelection = React.useCallback(
const logSelection = useCallback(
(event: React.MouseEvent) => {
event.preventDefault();
event.stopPropagation();
if (!fileBrowserRef.current) return;
console.log(fileBrowserRef.current.getFileSelection());
},
[files, fileBrowserRef]
[fileBrowserRef]
);

const randomizeSelection = React.useCallback(
const randomizeSelection = useCallback(
(event: React.MouseEvent) => {
event.preventDefault();
event.stopPropagation();
Expand All @@ -430,8 +433,8 @@ export const FilesSelection: Story = () => {
<button type="button" onClick={randomizeSelection}>
Select files
</button>
<button type="button" onClick={getSelection}>
Get selected files
<button type="button" onClick={logSelection}>
Log selection
</button>
<FilePicker
ref={fileBrowserRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface FilePickerTheme {
// IMPLEMENTATION NOTES: Currently FilePicker component works with his own icon set.
// In future might be tweaked.
setChonkyDefaults({ iconComponent: ChonkyIconFA });

export interface FilePickerProps extends Partial<FileBrowserProps> {
theme?: FilePickerTheme;
styles?: Record<string, string>;
Expand Down

0 comments on commit 9978bd1

Please sign in to comment.