Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dominicbarnes/deku-siren-entity
A deku component for rendering a siren entity.
https://github.com/dominicbarnes/deku-siren-entity
Last synced: 6 days ago
JSON representation
A deku component for rendering a siren entity.
- Host: GitHub
- URL: https://github.com/dominicbarnes/deku-siren-entity
- Owner: dominicbarnes
- License: mit
- Created: 2015-08-10T03:37:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-16T08:37:45.000Z (about 9 years ago)
- Last Synced: 2024-12-05T09:24:45.310Z (about 1 month ago)
- Language: JavaScript
- Size: 41 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deku - deku-siren-entity - A deku component for rendering a siren entity (Components)
README
# deku-siren-entity
> A component for rendering a [siren](https://github.com/kevinswiber/siren) entity.
> Primarily used during development, while still discovering the API you are
> working with.[![npm version](https://img.shields.io/npm/v/deku-siren-entity.svg)](https://www.npmjs.com/package/deku-siren-entity)
[![npm dependencies](https://img.shields.io/david/dominicbarnes/deku-siren-entity.svg)](https://david-dm.org/dominicbarnes/deku-siren-entity)
[![npm dev dependencies](https://img.shields.io/david/dev/dominicbarnes/deku-siren-entity.svg)](https://david-dm.org/dominicbarnes/deku-siren-entity#info=devDependencies)
[![build status](https://img.shields.io/travis/dominicbarnes/deku-siren-entity.svg)](https://travis-ci.org/dominicbarnes/deku-siren-entity)## Usage
During development, this component is meant to be a fallback that can display
a working browser for a siren API. As you flesh out your own interface, this
component will be used less. (or remove it entirely, but it makes a good debugging
tool)```js
import dom from 'virtual-element';
import Entity from 'deku-siren-entity';export function render({ props }) {
let { entity } = props;return ;
function follow(link, a) {
// use your client to follow the link to a new entity
}function submit(action, data, form) {
// use your client to submit the action and get the next entity
}
}
```Building your own interface on the given API is as simple as adding a
conditional. For example:```js
if (entity.class.indexOf('home') > -1) {
return ;
} else {
return ;
}
```The nuances of this approach will probably be changed heavily as I actually
use this module in practice.