peopledb/src/components/PersonSearch.js
// Display Search Results in table body
Display Search Results in table body
Display Search Results in table body
function SearchResults(props) {
    if (props.ppl.length === 0) {
        return <div />;
    }
    const pplElements = props.ppl.map(person => {
        return (
            <tr
                key={person.id}
                onClick={() => props.history.push(`/detail/${person.id}`)}
            >
                <td>{person.id}</td>
                <td>{person.first_name}</td>
                <td>{person.last_name}</td>
                <td>{person.email}</td>
            </tr>
        );
    });
    return (
        <Table hover responsive>
            <thead>
                <tr>
                    <th>ID</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Email</th>
                </tr>
            </thead>
            <tbody>{pplElements}</tbody>
        </Table>
    );
}
function SearchResults ( props ) { if ( props . ppl . length === 0 ) { return < div / > ; } const pplElements = props . ppl . map ( person => { return ( < tr key = { person . id } onClick = { ( ) => props . history . push ( ` ${ person . id } ` ) } > < td > { person . id } < / td > < td > { person . first_name } < / td > < td > { person . last_name } < / td > < td > { person . email } < / td > < / tr > ) ; } ) ; return ( < Table hover responsive > < thead > < tr > < th > ID < / th > < th > First Name < / th > < th > Last Name < / th > < th > Email < / th > < / tr > < / thead > < tbody > { pplElements } < / tbody > < / Table > ) ; }
Display Search Results in table body
Display Search Results in table body
// Check if there are any search results