Code Monkey home page Code Monkey logo

ember-yielded-portals's Introduction

yielded-portals

An example of how to create advanced component APIs by combining ember-portal and contextual components.

Ember Version

Example

{{#test-yields as |portals|}}
  {{#portals.header}}
    Header
  {{/portals.header}}

  Body

  {{#portals.footer}}
    Footer
  {{/portals.footer}}
{{/test-yields}}

Run this app for the working version. Note that you can use the component multiple times and the portals will "wormhole" into the correct instance of the component.

You can also nest components with portals.

See the component definition here.

Potential Drawbacks

  1. Currently the portal components that the user uses, leave remnant DOM nodes, which you might have to account for in your CSS. They will be wherever the user placed them in the component's block. Using tagName="" prevents nested divs, but still renders a div where the portal was used in the block.

  2. Using the same portal multiple times in the same block will only render the last portal of that type in the block. Workaround: Add showingPortalItem=true to the portal-content to append instead of replace.

Related Discussions

Build

See the ember-cli 1.13 readme template for basic instructions.

ember-yielded-portals's People

Contributors

ember-tomster avatar

Stargazers

Chris Thoburn avatar Kelly Jensen avatar Ilya Radchenko avatar

Watchers

Ilya Radchenko avatar James Cloos avatar  avatar

ember-yielded-portals's Issues

Discussion

Any thoughts/ideas can go here

Drawbacks

  • Remnant DOM nodes (css issues)
  • Portals override each other if used multiple times (ember-portal issue).

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.