import Table from './Table.coffee'
import { Links } from '../../../api/links/links.coffee'

observer class CustomComponent extends Component
  @propsTypes:
    row: PropTypes.object.isRequired

  render: =>
    <div>custom component and value is { @props.value }</div>

export default InfoData = withTracker(=>
  linksHandle = Meteor.subscribe 'links'

  columns = [
    name: '_id'
    type: 'string'
    isMain: true
    title: 'ID'
    width: 150
  ,
    name: 'action'
    type: 'button'
    title: '액션'
    width: 150
    buttons: [
      color: 'blue'
      onClick: (row) =>
        console.log row
      text: '액션1'
    ,
      color: 'grey'
      onClick: (row) =>
        console.log row
      text: '액션2'
    ]
  ,
    name: 'url'
    type: 'string'
    onClick: (raw) =>
      console.log raw
    title: 'Url'
    width: 150
  ,
    name: 'createdAt'
    type: 'date'
    title: '생성일'
    width: 150
  ,
    name: 'number'
    type: 'number'
    title: '숫자'
    width: 150
  ]

  isLoading: !linksHandle.ready()
  rows: Links.find().fetch()
  columns: columns
) Table
