GithubHelp home page GithubHelp logo

redpist / ember-masonry-grid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gmurphey/ember-masonry-grid

0.0 3.0 0.0 95 KB

An ember-cli addon to quickly and easily create grids using Masonry.

License: MIT License

JavaScript 99.44% CSS 0.56%

ember-masonry-grid's Introduction

ember-masonry-grid

This ember-cli addon imports the Masonry library and allows you to quickly and easily build masonry grid views.

Installation

npm install --save-dev ember-masonry-grid

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

masonry-grid

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

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

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

If we wanted to redefine the item class for Masonry, we'd write the following:

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

For a full list of options that are exposed, please see the Masonry 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-masonry-grid will observe. When the property changes, Masonry will re-initalize itself and update its layout.

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

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

Every time the length of the colors property is changed, Masonry 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

  • ember test
  • ember test --server

Building

  • ember build

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

ember-masonry-grid's People

Contributors

ember-tomster avatar redpist avatar

Watchers

 avatar  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.