Git Product home page Git Product logo

Comments (16)

erikjung avatar erikjung commented on August 10, 2024

There was an effort towards a solution like this, but it's only partially implemented: cloudfour/drizzle-builder#71

I'll cross-reference this issue in the builder repo and revisit the WIP to see where things stand.

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

One more note related to this: Ideally, this feature would include an update to the default Drizzle UI that nested one or more example components inside of a collection (i.e., "Components/Button" instead of just "Button").

from drizzle.

megnotarte avatar megnotarte commented on August 10, 2024

Large

from drizzle.

erikjung avatar erikjung commented on August 10, 2024

@tylersticka

One more note related to this: Ideally, this feature would include an update to the default Drizzle UI that nested one or more example components inside of a collection (i.e., "Components/Button" instead of just "Button").

I agree, and I think this should be encouraged. I can make a PR for that soon.

Aside from this, is there anything else we feel is absolutely required before marking this as complete?

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

I don't think so? It's hard to say without seeing the potentially "final" product.

from drizzle.

erikjung avatar erikjung commented on August 10, 2024

This file is probably the best demonstration:

https://github.com/cloudfour/drizzle/blob/master/src/templates/drizzle/nav.hbs

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

So what about a top-level folder without an index, like "Components"? I'm curious if the departures from my example in the description (<h5>Components</h5>) are intentional choices or not.

from drizzle.

erikjung avatar erikjung commented on August 10, 2024

To be clear, an index page is never a requirement, but here's what iterating over the components would look like for a typical project:

{{#each (collections "components")}}
  {{url}}
  {{name}}
{{/each}}

As seen in cloudfour/drizzle-builder#91

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

Is there any way of telling if those collections contain any patterns directly, or contain only collections?

I'm basically asking if there's an intelligent way of determining when a folder should be used as an organizational heading or when it should be a link. And to me, that would be determined based on what's inside of it, right?

from drizzle.

erikjung avatar erikjung commented on August 10, 2024

@tylersticka

Re-reading this issue, I'm realizing that the current helpers probably aren't going to get us to where we want to be. They all return flat arrays based on the path query.

Is this code an accurate description of what you'd like to do?

<ul>
  {{#each navItems}}
    <li>
      <a href="{{url}}">{{title}}</a>
      {{#if submenu}}
        <h5>{{submenu.heading}}</h5>
        <ul>
          {{#each submenu.items}}
            <li>
              <a href="{{url}}">{{title}}</a>
            </li>
          {{/each}}
        </ul>
      {{/if}}
    </li>
  {{/each}}
</ul>

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

Almost. In your example, I'm not sure why we'd output the <a> and the <h5>. I'm not even sure if pages and collections need to be in the same <ul>.

Basically, I want to be able to ape the sort of navigation that Solid does:

screen shot 2016-05-18 at 10 41 52 am

Or even that Lightning does:

screen shot 2016-05-18 at 10 42 03 am

If you're ever wondering "is the nav meeting Tyler's expectations yet," the answer to that question is the same as "could we recreate Solid's nav?" If the answer is "no," then I still have complaints. 😁

from drizzle.

erikjung avatar erikjung commented on August 10, 2024

@tylersticka

We can recreate it currently, but not within one top-level loop. For example:

src/pages
├── colors.md
├── demos
│   ├── demo-example-1.hbs
│   ├── demo-example-2.hbs
│   └── index.hbs
├── docs
│   ├── doc-example-1.md
│   ├── doc-example-2.md
│   └── index.hbs
└── index.hbs

src/patterns
├── components
│   ├── button
│   │   ├── base.hbs
│   │   ├── disabled.hbs
│   │   └── primary.hbs
│   └── grid
│       └── base.hbs
└── typography
    ├── collection.yaml
    ├── headings.hbs
    ├── lists.hbs
    ├── misc.hbs
    └── paragraphs.hbs
{{!-- Top-level pages --}}
<ul class="drizzle-Nav-menu">
  {{#each (pages sortby="order")}}
    <li>
      {{> nav-item label=data.title}}
    </li>
  {{/each}}
</ul>

{{!-- Top-level patterns --}}
<ul class="drizzle-Nav-menu">
  {{#each (collections)}}
    <li>
      {{> nav-item label=name}}
    </li>
  {{/each}}
</ul>

{{!-- Component patterns --}}
<h5 class="drizzle-Nav-item">Components</h5>
<ul class="drizzle-Nav-menu">
  {{#each (collections "components")}}
    <li>
      {{> nav-item label=name}}
    </li>
  {{/each}}
</ul>

{{!-- Demos and docs --}}
<h5 class="drizzle-Nav-item">Other Stuff</h5>
<ul class="drizzle-Nav-menu">
  {{#with (page "demos/index")}}
    <li>
      {{> nav-item label=data.title}}
    </li>
  {{/with}}
  {{#with (page "docs/index")}}
    <li>
      {{> nav-item label=data.title}}
    </li>
  {{/with}}
</ul>

screen shot 2016-05-18 at 1 56 32 pm

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

Yep, that's basically the same way we did this sorta thing in Fabricator.

I'd like to be able to build that sorta nav by checking if "Components" has any immediate children or only collections. That would let me build it with a single loop, and not copy and paste chunks of code every time I add a similar category.

If there's still confusion, we should chat about it with voices.

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

In case it's helpful, here's a hypothetical Handlebars template I'd love to write (if it were possible):

<ul>
  {{#each pages}}
    <li><a href="{{url}}">{{label}}</a></li>
  {{/each}}
  {{#each collections}}
    <li>
      {{#if collections}} {{! This collection has nested collections. }}
        {{label}}
        <ul>
          {{#each collections}}
            <li><a href="{{url}}">{{label}}</a></li>
          {{/each}}
        </ul>
      {{else}} {{! Link to this collection directly. }}
        <li><a href="{{url}}">{{label}}</a></li>
      {{/if}}
    </li>
  {{/each}}
</ul>

from drizzle.

erikjung avatar erikjung commented on August 10, 2024

@tylersticka How closable does this feel with cloudfour/drizzle-builder#95 in place?

(Keeping in mind that we can reopen it later.)

from drizzle.

tylersticka avatar tylersticka commented on August 10, 2024

@erikjung Go for it.

from drizzle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.