11import React from 'react' ;
2+ import { CardStack , Card } from 'react-cardstack' ;
23
34import ClientService from 'services/Client' ;
45import Error from 'components/Error/Error'
@@ -8,7 +9,7 @@ class Client extends React.Component
89 constructor ( props ) {
910 super ( props ) ;
1011 this . state = {
11- clients : [ ] ,
12+ clients : null ,
1213 error : ''
1314 } ;
1415 this . getClients ( ) ;
@@ -29,34 +30,36 @@ class Client extends React.Component
2930 if ( this . state . error ) {
3031 return ( < Error error = { this . state . error } /> ) ;
3132 }
33+ if ( ! this . state . clients ) {
34+ return < div > Loading...</ div > ;
35+ }
3236 const clientList = this . state . clients . map ( ( client , key ) => {
3337 return (
34- < tr key = { key } >
35- < td > { client . name } </ td >
36- < td > { client . address } </ td >
37- < td > { client . city } </ td >
38- < td className = "is-icon" > < a href = "#" > < i className = "fa fa-calendar" > </ i > </ a > </ td >
39- < td className = "is-icon" > < a href = "#" > < i className = "fa fa-search" > </ i > </ a > </ td >
40- </ tr >
38+ < Card key = { key } >
39+ < article className = { `message ${ ( ( key % 2 ) ? 'is-success' : 'is-info' ) } ` } >
40+ < div className = "message-header" >
41+ < strong > { client . name } </ strong >
42+ </ div >
43+ < div className = "message-body" >
44+ < address > { client . address } </ address >
45+ < city > < small > { client . city } </ small > </ city >
46+ </ div >
47+ </ article >
48+ </ Card >
4149 ) ;
4250 } ) ;
4351
4452 return (
4553 < div className = "container hello" >
46- < table className = "table" >
47- < thead >
48- < tr >
49- < th > Name</ th >
50- < th > Address</ th >
51- < th > City</ th >
52- < th > </ th >
53- < th > </ th >
54- </ tr >
55- </ thead >
56- < tbody >
57- { clientList }
58- </ tbody >
59- </ table >
54+ < CardStack
55+ height = { 100 }
56+ width = { 1200 }
57+ background = '#00d1b2'
58+ hoverOffset = { 0 } >
59+
60+ { clientList }
61+
62+ </ CardStack >
6063 </ div >
6164 ) ;
6265 }
0 commit comments