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

feat: Add story tree UI (fix #16) #19

Merged
merged 12 commits into from
Feb 15, 2022
Merged

feat: Add story tree UI (fix #16) #19

merged 12 commits into from
Feb 15, 2022

Conversation

hugoattal
Copy link
Collaborator

@hugoattal hugoattal commented Feb 15, 2022

fix: #16

Description

This generate a file tree for stories:
image

About the configuration:

tree.file

  • title (default) use slashes of the story title to create the path
  • path use the relative directory path of the story
  • function a function that takes an object {title, path} and return an array of string, the last one being the file name

tree.order

  • asc (default) alphabetical order in each directory
  • function a function that takes two string in argument and return a number to sort files

Additional context

The creation of the tree require two steps:

  • On step to create an object with folder being keys, so that it's fast to generate (O(n))
  • On step to generate the array tree to keep files in order

If I used directly an array without the object step, it could have been quite slow to check if subfolder already exists (O(n²)).
Though, it might be overengineered, you tell me.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@hugoattal hugoattal added the enhancement New feature or request label Feb 15, 2022
@hugoattal hugoattal requested a review from Akryum February 15, 2022 14:05
@hugoattal hugoattal self-assigned this Feb 15, 2022
@netlify
Copy link

netlify bot commented Feb 15, 2022

❌ Deploy Preview for histoirejs failed.

🔨 Explore the source changes: 0e15511

🔍 Inspect the deploy log: https://app.netlify.com/sites/histoirejs/deploys/620c310dc74d5b0007f88e96

@Akryum Akryum merged commit 9881810 into main Feb 15, 2022
@Akryum Akryum deleted the file-tree branch February 15, 2022 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Story/variant trees
2 participants