react-file-icon icon indicating copy to clipboard operation
react-file-icon copied to clipboard

Using Defaults

Open pschoffer opened this issue 3 years ago • 1 comments

Hi this is a great project @corygibbons !

What do you think about adding a prop like usingDefaultStyles that would use the defaults styles based on the extension?

So instead of:

const extension = getFileExtension(file);
const iconStyles = (defaultStyles as any)[extension] || {}; // Typescript does not like the type of defaultStyles as the key is not string

return <FileIcon extension={suffix} {...iconStyles} />

You could do (which would internally do the same as above):

const extension = getFileExtension(file);

return <FileIcon extension={suffix} usingDefaultStyles={true} />

I assume this is the most common use-case, or?

pschoffer avatar Jul 08 '21 04:07 pschoffer

That's a probably a good idea but I need to think on it a bit as I've been away from this project recently.

corygibbons avatar Jul 29 '21 18:07 corygibbons