Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation comments in index.js #808

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 42 additions & 38 deletions addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,38 @@ import Row from './classes/Row';
*
* ```javascript
* // components/my-table.js
* import { computed } from '@ember/object';
* import Component from '@glimmer/component';
* import Table from 'ember-light-table';
*
* export default Ember.Component.extend({
* model: null,
*
* columns: computed(function() {
* return [{
* label: 'Avatar',
* valuePath: 'avatar',
* width: '60px',
* sortable: false,
* cellComponent: 'user-avatar'
* }, {
* label: 'First Name',
* valuePath: 'firstName',
* width: '150px'
* }, {
* label: 'Last Name',
* valuePath: 'lastName',
* width: '150px'
* }];
* }),
*
* table: computed('model', function() {
* return Table.create({ columns: this.get('columns'), rows: this.get('model') });
* })
* });
* export default class MyTable extends Component {
* model = null;
*
* get columns() {
* return [
* {
* label: 'Avatar',
* valuePath: 'avatar',
* width: '60px',
* sortable: false,
* cellComponent: 'user-avatar',
* },
* {
* label: 'First Name',
* valuePath: 'firstName',
* width: '150px',
* },
* {
* label: 'Last Name',
* valuePath: 'lastName',
* width: '150px',
* },
* ];
* }
*
* get table() {
* return Table.create({ columns: this.columns, rows: this.model });
* }
* }
* ```
*
* @module Usage
Expand All @@ -72,31 +76,31 @@ import Row from './classes/Row';
* The `light-table` component exposes 3 contextual component (head, body, and foot).
*
* ```hbs
* {{#light-table table as |t|}}
* <LightTable @table={{this.table}} as |t|>
*
* {{t.head}}
* <t.head />
*
* {{#t.body as |body|}}
* {{#body.expanded-row as |row|}}
* {<t.body as |body|>
* <body.expanded-row as |row|>
* Hello <b>{{row.firstName}}</b>
* {{/body.expanded-row}}
* </body.expanded-row>
*
* {{#if isLoading}}
* {{#body.loader}}
* <body.loader>
* Loading...
* {{/body.loader}}
* </body.loader>
* {{/if}}
*
* {{#if table.isEmpty}}
* {{#body.no-data}}
* <body.no-data>
* No users found.
* {{/body.no-data}}
* </body.no-data>
* {{/if}}
* {{/t.body}}
* </t.body>
*
* {{t.foot}}
* <t.foot />
*
* {{/light-table}}
* </LightTable>
* ```
*
* Each of these contextual components have a wide array of options so it is advised to look
Expand Down