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

feat: implement table component #444

Merged
merged 9 commits into from
Dec 22, 2018
Merged

Conversation

AlejandroYanes
Copy link
Collaborator

fixes #289

@coveralls
Copy link

coveralls commented Dec 13, 2018

Pull Request Test Coverage Report for Build 684

  • 44 of 45 (97.78%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 77.825%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/Column/index.js 2 3 66.67%
Totals Coverage Status
Change from base Build 532: 0.5%
Covered Lines: 1287
Relevant Lines: 1584

💛 - Coveralls

}

Table.propTypes = {
data: PropTypes.array.isRequired,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the descriptions to the props.

import Rows from './body';
import Headers from './head';
import './styles.css';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the component description

@@ -0,0 +1,40 @@
#Basic Table
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need change this title by ##### simple Table

@TahimiLeonBravo
Copy link
Collaborator

TahimiLeonBravo commented Dec 14, 2018

you have to export the Table component in the root index.

Copy link
Collaborator

@reiniergs reiniergs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good, some minor changes & I don't see any test


export default function Rows(props) {
const { data, columns } = props;
if (data && columns) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if data and column are arrays since you are going to do map

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array.isArray(data) && Array.isArray(columns)


componentDidMount() {
if (!this.columns) {
this.getColumns();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are resolving the columns only one time when the componentDidMount, what happen if the customer change the columns dynamically after the component was mounted

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the columns is always generated from the column passed by the developer and the change of the column imply render of the table then we should put it in the state of the component

<Table data={tableData} style={tableStyles}>
<Column header="Name" field="name" />
<Column header="Company" field="company" />
<Column header="email" field="email" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add more examples that use the component prop of the Column component

@LeandroTorresSicilia
Copy link
Member

start the library and open the console when develop, there are lot of warnings, and one is very important:
Error: Maximum update depth exceeded.
currently componentDidMount is being called infinite times

PropTypes.string,
]),
/** The component with wich to render the content of each cell */
component: PropTypes.node.isRequired,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that component should not be required
Also add a simple table example for Column component

return (
<table className={className} style={style}>
<thead className="rainbow-table_head">
<tr className="rainbow-table_header-row">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix indentation

</tr>
</thead>
<tbody className="rainbow-table_body">
<Rows data={data} columns={columns} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same ^^


Table.propTypes = {
/** An array containing the objects to be displayed */
data: PropTypes.array.isRequired,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set prop as array of objects

@LeandroTorresSicilia LeandroTorresSicilia merged commit efab5ce into master Dec 22, 2018
@TahimiLeonBravo TahimiLeonBravo deleted the implement-table branch September 23, 2019 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: implement dataTable component (1st version)
5 participants