generated from learn-co-curriculum/SENG-LIVE-Phase-2-ProjectShowcase
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0637271
commit a5b06bf
Showing
6 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 +1,15 @@ | ||
import Header from "./components/Header"; | ||
import ProjectForm from "./components/ProjectForm"; | ||
import ProjectList from "./components/ProjectList"; | ||
|
||
function App() { | ||
return <div className="App">Project showcase</div>; | ||
return ( | ||
<div className="App"> | ||
<Header /> | ||
<ProjectForm /> | ||
<ProjectList /> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
15 changes: 15 additions & 0 deletions
15
01_components_and_props/project_showcase/src/components/Header.js
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const Header = () => { | ||
return ( | ||
<header> | ||
<h1> | ||
<span className="logo">{"//"}</span> | ||
Project Showcase | ||
</h1> | ||
<nav> | ||
<button>Light Mode</button> | ||
</nav> | ||
</header> | ||
) | ||
} | ||
|
||
export default Header; |
9 changes: 9 additions & 0 deletions
9
01_components_and_props/project_showcase/src/components/ProjectForm.js
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const ProjectForm = () => { | ||
return ( | ||
<form> | ||
<h3>Add Project</h3> | ||
</form> | ||
) | ||
} | ||
|
||
export default ProjectForm; |
26 changes: 26 additions & 0 deletions
26
01_components_and_props/project_showcase/src/components/ProjectList.js
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import projects from "../projects"; | ||
import ProjectListItem from "./ProjectListItem"; | ||
|
||
const ProjectList = () => { | ||
console.log('projects', projects); | ||
|
||
// mapping over an array of objects to create an array of react components | ||
// is a very common pattern that you'll see across react projects | ||
// there is a component to render each item in a list and it will accept | ||
// one element in the array (an object) as a prop and then use it to render | ||
// the contents of that object in the JSX. | ||
const renderedProjects = projects.map(projectObj => { | ||
return <ProjectListItem project={projectObj} /> | ||
}) | ||
return ( | ||
<section> | ||
<h1>All Projects</h1> | ||
<ul className="cards"> | ||
|
||
{renderedProjects} | ||
</ul> | ||
</section> | ||
) | ||
} | ||
|
||
export default ProjectList |
25 changes: 25 additions & 0 deletions
25
01_components_and_props/project_showcase/src/components/ProjectListItem.js
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const ProjectListItem = ({ project }) => { | ||
console.log('project', project) | ||
const { name, image, about, link, phase } = project; | ||
return ( | ||
<li className="card"> | ||
<figure className="image"> | ||
<img src={image} alt={name} /> | ||
<button className="claps">👏0</button> | ||
</figure> | ||
<section className="details"> | ||
<h4>{name}</h4> | ||
<p>{about}</p> | ||
<p> | ||
<a href={link}>Link | ||
</a> | ||
</p> | ||
</section> | ||
<footer className="extra"> | ||
<span className="badge blue">Phase {phase}</span> | ||
</footer> | ||
</li> | ||
) | ||
} | ||
|
||
export default ProjectListItem; |