Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Template sorting #14

Closed
hauptrolle opened this issue Jan 1, 2021 · 5 comments
Closed

Template sorting #14

hauptrolle opened this issue Jan 1, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@hauptrolle
Copy link
Owner

Feature request

Describe the feature you need

It should be possible to sort templates.

Additional information

@hauptrolle hauptrolle added the enhancement New feature or request label Jan 1, 2021
@hauptrolle
Copy link
Owner Author

I guess the most simple solution would be to just add a prefix to the template names like 01_featureGrid. So the Sorting in the fs and the website is the same.

@hauptrolle
Copy link
Owner Author

Another idea would be, to not use the filesystem as the source of truth, and just create a plain object which holds all the data. For example:

const data = [
  {
    name: "Page Sections",
    url: "page-sections",
    children: [
      {
        name: "Features",
        url: "features",
        children: [
          {
            name: "Grid list with heading",
            fileName: "gridListWithHeading",
          },
          {
            name: "Simple three column grid",
            fileName: "simpleThreeColumns",
          },
        ],
      },
    ],
  },
];

With this we are more flexibel for how we

  • structure the urls
  • define the headings for the example frames
  • sort the templates

Downsides:

  • this could be a mess when adding more and more templates
  • fileName has to be exactly the same

What is your opinion on this subject @lazarnikolov94 ?

@nikolovlazar
Copy link
Contributor

I like the idea of structuring the data in a plain object. It does add a dependency when adding new templates, but on the other hand it'll give us a lot of room for custom features, such as easy sorting, IDs, tags maybe etc...

@hauptrolle
Copy link
Owner Author

Sounds good! Will try to refactor a little bit :)

@hauptrolle hauptrolle self-assigned this Jan 2, 2021
@hauptrolle hauptrolle mentioned this issue Jan 2, 2021
@hauptrolle
Copy link
Owner Author

Fixed in #17

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants