react-file-icon
react-file-icon copied to clipboard
Using Defaults
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?
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.