- Replace
<your_account>
with your Github username in the DEMO LINK - Follow the React task guideline
-
Load
people
from API and show the number of currently visible people in theApp
component. -
Implement
PeopleTable
component accepting an array of people as a param. It should show these columns:id
(position in the original array starting from 1)name
sex
born
died
mother
father
<PeopleTable people={people} />
<table className="PeopleTable"> <thead>...</thead> <tbody>...</tbody> </table>
- add
border-collapse: collapse
style to the table
-
Implement
Person
component accepting aperson
and displaying all the data described above<tr class="Person"> <td></td> ... <td></td> </tr>
- add class
Person--male
/Person--female
based onsex
- add
text-decoration: line-through
for the names of people born before1650
- add class
-
Add
age
column (person.died - person.born
)- use
green
color for theage
of people who lived for>= 65
years
- use
-
add
century
column (Math.ceil(person.died / 100)
)- add class
Person--lived-in-${century}
to each<tr>
- add class
-
Mark a person row as selected when the user clicks on it (
Person--selected
)- there can be only one selected person at a time
-
Add a single
<input>
to filter people byname
,mother
andfather
-
add sorting by
name
-
add sorting by
id
,sex
,born
,died
,age
,century
-
(* OPTIONAL) Implement sorting in both directions
- sorting must work together with filtering
-
(* OPTIONAL) Add
children
column with a list of children names of names -
(* OPTIONAL) Implement
PersonName
component to display the name with some styling based on person data. Use if for all the names in the table (for example use blue color for men and red for women) -
(* OPTIONAL) Create a
NewPerson
component with a form to add new people to the table- all the fields are required
sex
should be chosen among 2 options (radio buttons)- all the above rules should be applied to added people
-
(* OPTIONAL) Add data validations:
died - born
should be >= 0 and < 150name
should allow to enter only letters and spaces- implement
<select>
formother
andfather
it should display only people of appropriate sex who were alive in the year of birth (so the select should be empty before the born year was entered)
/people/carlos-haverbeck?query=carl&sorBy=born&sortOrder=desc
Add React Router into the PeopleTable
working like described below:
- The component should appear only when the URL starts from
/people
so People table is not visible on/
or/not-people
- When selecting a person navigate to
/people/carolus-haverbeke
where so the person name is added to the URLCarolus Haverbeke
should be selected if the page is loaded at/people/carolus-haverbeke
- When filtering people please add
?query=asd
whereasd
is a string entered by the user- The
query
should be preserved in the URL when selecting a user or changing selection - Filter the people if the page is loaded with
?query=asd
- (*) Use
debounce
so the entered value is updated only when the user stoped typing for at least500ms
- The
- When sorting add
?sortBy=born
param to the URL- It should work together with filter
- The people should be sorted by
born
if the page is loaded with?sortBy=born
- (*) add
?sortOrder=asc
ordesc
to add ability to sort in reversed order
- (*) Use
/people/new
address to show theNewPerson
component- When the person is added you should navigate back to the
/people
page
- When the person is added you should navigate back to the