-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from wkdewey/nested_dynamic_form
Nested dynamic form
- Loading branch information
Showing
14 changed files
with
249 additions
and
146 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
const AncestryGroups = (props) => | ||
props.ancestry_groups.map((ancestry_group) => { | ||
console.log(props.ancestry_groups); | ||
const AncestryGroups = (props) => { | ||
if (props.ancestryGroups.length > 0) { | ||
return props.ancestryGroups.map((ancestryGroup) => { | ||
return ( | ||
<div className="ancestry_group" key={ancestryGroup.id}> | ||
<h3> | ||
<Link | ||
key={ancestryGroup.id} | ||
to={`/ancestry_groups/${ancestryGroup.id}`} | ||
> | ||
{ancestryGroup.attributes.name} | ||
</Link> | ||
</h3> | ||
<p> | ||
Percent of US Population:{" "} | ||
{ancestryGroup.attributes.national_percent} | ||
</p> | ||
</div> | ||
); | ||
}); | ||
} else { | ||
return ( | ||
<div className="ancestry_group" key={ancestry_group.id}> | ||
<h3> | ||
<Link | ||
key={ancestry_group.id} | ||
to={`/ancestry_groups/${ancestry_group.id}`} | ||
> | ||
{ancestry_group.attributes.name} | ||
</Link> | ||
</h3> | ||
<p> | ||
Percent of US Population: {ancestry_group.attributes.national_percent} | ||
</p> | ||
<div> | ||
<h3>Loading, please wait.</h3> | ||
</div> | ||
); | ||
}); | ||
} | ||
}; | ||
|
||
export default AncestryGroups; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.