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

[Infra] Rethink addon primitives as contextual and not UI components #61

Open
Alonski opened this issue May 5, 2019 · 3 comments
Open

Comments

@Alonski
Copy link
Member

Alonski commented May 5, 2019

Currently this addon makes some opinionated choices about how the UI of the collapsible panels is rendered.

A better fit for this addon might be to provide contextual components that don't render anything but instead provide the primitives needed for collapsible panels without the UI.

@cah-brian-gantzler
Copy link

cah-brian-gantzler commented Dec 30, 2019

Now that modifiers are out, I think this would best be served with modifiers. I just made a pull request for ember sortable, very similar in the demands.

Looking into this, easily doable except for liquid fire. Would have to drop support for animations.

What would be better would be if liquid fire could supply modifiers. Ok looking into that if would be ember-animated now. Would it possibly be better for the end user to wrap panel.body in an animated-if themselves and remove the dependency on animate from this addon completely.

@cah-brian-gantzler
Copy link

Ok where this differs from ember sortable is the hiding of the body. A modifier cant really do that except to make the DOM element hidden. Not really the same thing.

Where you are going to run into the problem with primitives that dont render anything is where to put the toggle. When it comes down to it a collapsible panel is an if and an isOpen variable.

The panels component yields some functionality.

@cah-brian-gantzler
Copy link

So what would this look like. Im guessing the below? If user wanted animation they would replace if with animated-if or their animation addon of choice. Its not this addon's responcibility.

The click me isnt an anchor but they could make an anchor and put the {{on}} it. Thats the point really. Allow them to specify the DOM.

{{#cp-panel as |p|}}
    <p class="{{p.toggleClass}}" {{on "click" p.toggleAction}}>Click me!</p>

  {{#if p.isOpen}}
    <div class=""{{p.bodyClass}}">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nemo repellendus nisi asperiores esse aperiam aliquid nulla ad dolor autem neque, nihil inventore temporibus delectus earum facere corporis, quam ipsum maxime.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus neque magnam, hic quis beatae repellendus harum modi pariatur minus quidem alias! Eius incidunt impedit eaque, est, illo officiis expedita molestiae.</p>
    </div>
  {{/if}}
{{/cp-panel}}

I hate to say it but how far is that from below, which I believe is a collapsible panel


<p class="cp-Panel-toggle {{if this.isOpen "cp-is-open"}}" {{on "click" (toggle "isOpen" this)}}>Click me!</p>

{{#if this.isOpen}}
    <div class="cp-Panel-body {{if this.isOpen "cp-is-open"}}">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nemo repellendus nisi asperiores esse aperiam aliquid nulla ad dolor autem neque, nihil inventore temporibus delectus earum facere corporis, quam ipsum maxime.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus neque magnam, hic quis beatae repellendus harum modi pariatur minus quidem alias! Eius incidunt impedit eaque, est, illo officiis expedita molestiae.</p>
    </div>
{{/if}}

(toggle) is available from https://github.com/DockYard/ember-composable-helpers#toggle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants