Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/michalsnik/ember-component-respo

Dimensions-aware responsive breakpoints for ember components
https://github.com/michalsnik/ember-component-respo

Last synced: 24 days ago
JSON representation

Dimensions-aware responsive breakpoints for ember components

Awesome Lists containing this project

README

        

# ember-component-respo

[![NPM version](https://img.shields.io/npm/v/ember-component-respo.svg?style=flat)](https://npmjs.org/package/ember-component-respo)
[![Build Status](https://travis-ci.org/michalsnik/ember-component-respo.svg?branch=master)](https://travis-ci.org/michalsnik/ember-component-respo)

> This is an addon that enhances components with dynamic classes based on their actual sizes, regardless of window width.

## 🚀 Usage

### 1. Install addon:

```
ember install ember-component-respo
```

### 2. Setup `respo` breakpoints and `classNameBindings`:

```javascript
export default Ember.Component.extend({
classNames: ['example-box'],
classNameBindings: ['respoClassNames'],
respo: [300, 480, 640],
});
```

Depending on the actual component's size it will add proper class names on top of it, like so:

```html


example box

```

Default prefixes are: `gt, gte, eq, lt, lte`. If you want to disable some, use the object form of `respo` for configuration:

```javascript
export default Ember.Component.extend({
classNames: ['example-box'],
classNameBindings: ['respoClassNames'],
respo: {
breakpoints: [300, 480, 640],
prefixes: ['gt', 'lt'],
},
});
```

## 🔓 License

This library is released under the MIT license.