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

fix(file-explorer): adds property not to show hidden files #488

Merged
merged 7 commits into from
Jun 7, 2022
Merged

fix(file-explorer): adds property not to show hidden files #488

merged 7 commits into from
Jun 7, 2022

Conversation

jerrywu001
Copy link
Contributor

@jerrywu001 jerrywu001 commented Jun 2, 2022

What kind of change does this pull request introduce?

provide a property(enableAutoHiddenFile: default value is false) in FIleExplorer Component that indicates whether files in the file tree are automatically hidden.

What is the current behavior?

Closes #482

What is the new behavior?

My solution is to provide a property that indicates whether files in the file tree are automatically hidden.LIke this:

// enableAutoHiddenFile: boolean; // default: false
<SandpackProvider
    files={{
      "/index.js": {
        code: "// index.js",
        active: true
      },
      "/index2.js": {
        code: "// index2.js"
      },
      "/src/index.js": {
        code:
          "// this file is generated by vanilla template, but it is not needed",
        hidden: true
      },
      "/hidden.js": {
        code: "// hidden.js",
        hidden: true
      }
    }}
    customSetup={{
      entry: "/index.js"
    }}
    template={"vanilla"}
  >
    <SandpackLayout>
      <SandpackFileExplorer enableAutoHiddenFile />
      <SandpackCodeEditor />
    </SandpackLayout>
  </SandpackProvider>

image

image

What steps did you take to test this? This is required before we can merge, make sure to test the flow you've updated.

add story: http://localhost:6006/?path=/story/bug-reports-issues--issue-482

Checklist

  • Documentation;
  • Storybook (if applicable);
  • Tests;
  • Ready to be merged;

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 2, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1226518:

Sandbox Source
Sandpack Blog Example 1 Configuration
sandpack-parcel-SandpackFileExplorer-hidden Issue #482

@danilowoz
Copy link
Member

Thanks, @jerrywu001 for fixing this issue! I took this change to refactor the class component to functional components and add some tests. Let me know what you think about these changes.

@danilowoz
Copy link
Member

@jerrywu001 what if we rename it from enableAutoHiddenFile to autoHiddenFiles? As the prop is a boolean, doesn't the enable seems redundant?

@danilowoz danilowoz changed the title fix 482: hidden-files-in-explorer fix(file-explorer): adds property not to show hidden files Jun 6, 2022
@jerrywu001
Copy link
Contributor Author

@jerrywu001 what if we rename it from enableAutoHiddenFile to autoHiddenFiles? As the prop is a boolean, doesn't the enable seems redundant?

Thanks, understand. What should I do next?

@danilowoz
Copy link
Member

Thanks, understand. What should I do next?
Your changes look good to me, but let me know if you want to review the PR and my changes. It's always good having another pair of eyes

Then it's ready to go!

@jerrywu001
Copy link
Contributor Author

Thanks, understand. What should I do next?
Your changes look good to me, but let me know if you want to review the PR and my changes. It's always good having another pair of eyes

Then it's ready to go!

Your changes are perfect, there is no need to review the PR.

@jerrywu001
Copy link
Contributor Author

How to pass the following checks🤣🤣🤣

  • Open In CodeSandbox / Open in CodeSandbox (pull_request)
  • CI / Chromatic deployment (pull_request)

@danilowoz

@danilowoz
Copy link
Member

I believe it's because your user doesn't have write access to this repo, and then these actions can't perform some operations. But it's fine, don't worry

@danilowoz danilowoz merged commit 1048fe9 into codesandbox:main Jun 7, 2022
@jerrywu001 jerrywu001 deleted the fix/hidden-files-in-explorer branch June 7, 2022 09:39
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.

SandpackFileExplorer show hidden files
2 participants