import gql from 'graphql-tag' import { Query } from 'react-apollo' import Link from 'next/link' import { InstrumentForm } from './Instrument' const INSTRUMENTS = gql` query INSTRUMENTS { instruments { id name description } } ` const InstrumentList = props => ( {({ data, loading, error }) => { const content = [

Instrument List

] if (loading) content.push(

Loading instruments...

) else if (error) content.push(

Error loading instruments: {error.message}

) else if (data.instruments.length > 0) content.push( ) else content.push(

No instruments found.

) content.push() return content }}
) export default InstrumentList