Giter Site home page Giter Site logo

ember-packery's Introduction

ember-packery

This ember-cli addon imports the Packery library and allows you to quickly and easily build bin-packed grid views.

Installation

ember install:addon ember-packery

That's it! The Packery library will automatically be imported in your app, and the grid-packery component will be available to all of your templates.

grid-packery

The grid-packery component accepts all of the options that Packery exposes. The naming is the same, and any option not specified will use the Packery default.

For example, if we wanted to a basic Packery view, we'd included the following in our template.

{{#grid-packery}}
  <div class="item">Item 1</div>
  <div class="item">Item 2</div>
  <div class="item">Item 3</div>
{{/grid-packery}}

If we wanted to redefine the item class for grid-packery, we'd write the following:

{{#grid-packery itemSelector=".piece"}}
  <div class="piece">Item 1</div>
  <div class="piece">Item 2</div>
  <div class="piece">Item 3</div>
{{/grid-packery}}

For a full list of options that are exposed, please see the Packery options.

A small caveat: while Ember allows us to pass most options to components as primitives, it doesn't handle null well. If you'd like to use null (as containerStyle, for example), you'll have to wrap it in quotes ('null').

Adding and Removing Items from a Masonry Layout

We can specify an items attribute that ember-packery will observe. When the property changes, Packery will re-initalize itself and update its layout.

For example, if our controller exposes the enumerable property colors:

{{#grid-packery items=colors}}
  {{#each colors}}
  <div class="item">
    Name: {{name}}
  </div>
  {{/each}}
{{/grid-packery}}

Every time the length of the colors property is changed, Packery will account for it and generate a new layout.

Contributing

If you find an issue or missing functionality, please don't hesistate to open a pull request.

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • npm test

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

ember-packery's People

Contributors

atalargo avatar bennettneale avatar ember-tomster avatar

Watchers

 avatar  avatar

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.