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

Some boostraps #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 0 additions & 120 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
import postData from "./data/posts.json";

import postData from "./data/posts";
import Hero from "./Hero"
import Nav from "./Nav.js"

function App() {
console.log(postData);
return <main></main>;

return <main>
<Nav />
<Hero />
<div className="App">

{
postData.map((post) => {
return (
<li className = 'card' key = {post.id}>
<span>{post.title}</span>
<button>Go to Post</button>
</li>
)
})
}

</div>
</main>;
}

export default App;
11 changes: 11 additions & 0 deletions src/Hero.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function Hero(){
return(
<div className="border-top border-bottom border-3">
<h2 className="py-5 text-center fs-1 script-font">
Travel is the only thing you buy that makes you richer...
</h2>
</div>
)
}

export default Hero;
17 changes: 17 additions & 0 deletions src/Nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function Nav(){
return (
<nav className="container nav by-4">
<h1 className="me-5">
Travel <span className="script-font text-warning">Blog</span>
</h1>
<a className="link-secondary nav-link mt-2" href = '#'>
About
</a>
<a className="link-secondary nav-link mt-2" href = "#">
Popular posts
</a>
</nav>
)
}

export default Nav;
26 changes: 26 additions & 0 deletions src/Tablerows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function TableRows(posts){
const grouping = posts.reduce((acc,post)=>{
if(acc[post.location]){
acc[post.location]++;
} else {
acc[post.location] = 1;
}
return acc;
},
{});

const result = [];
for (let location in grouping){
result.push(
<tr key={location}>
<th scope = "row">{location}</th>
<td className="text-center">
<span className="badge text-bg-secondary">{grouping[location]}</span>
</td>
</tr>
);
}
return result;
}

export default TableRows;
24 changes: 24 additions & 0 deletions src/components/LocationCards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// import { useState } from 'react'
// import postData from 'src/data/posts.json'


// export default function LocationCards () {
// const [postData, setpostData] = useState(postData)

// return (
// <div className="App">

// {
// postData.map((post) => {
// return (
// <li className = 'card' key = {post.id}>
// <span>{post.title}</span>
// <button>Go to Post</button>
// </li>
// )
// })
// }

// </div>
// )
// }