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

[docs] Add file explorer example to rich tree view customization docs #12707

Merged
merged 4 commits into from Apr 12, 2024

Conversation

noraleonte
Copy link
Contributor

Part of #12436

@noraleonte noraleonte added the docs Improvements or additions to the documentation label Apr 8, 2024
@noraleonte noraleonte self-assigned this Apr 8, 2024
Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

I know that you migrated the component almost as-is from the SimpleTreeView so the issue does not come from this PR per say.
But I'm not convinced that this example is similar to something people would actually implement.
It looks nice, but if you were building a real file explorer, you would not have the icon defined like this as React component in your dataset.

In which type of application do you think we would see this kind of example?

@noraleonte
Copy link
Contributor Author

you would not have the icon defined like this as React

@flaviendelangle You are probably right 🤔 Maybe defining the fileType in the data set would make more sense, and we could adjust the example to be more similar to an IDE's file explorer 🤔 WDYT?

@flaviendelangle
Copy link
Member

Yes that's what I had in mind.
We could add an optional fileType on the item, and then the icon would be something like:

let icon;
if (isExpandable) icon = folderIcon
else if (item.fileType) icon = getIconFromFileType(item.fileType)
else icon = defaultFileIcon

Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Looks great ! 🥳

</TreeItem2IconContainer>

<CustomLabel
{...getLabelProps()}
Copy link
Member

Choose a reason for hiding this comment

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

You can pass the additional props as a param of getLabelProps to be consistent

@noraleonte noraleonte merged commit a6c5ab7 into mui:master Apr 12, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants