Skip to content

Commit

Permalink
created a tour project using context Api
Browse files Browse the repository at this point in the history
  • Loading branch information
CyCodez committed Oct 18, 2022
1 parent 731d90d commit 81870af
Show file tree
Hide file tree
Showing 13 changed files with 69,289 additions and 127 deletions.
17,295 changes: 17,272 additions & 23 deletions 01-birthday-reminder/setup/package-lock.json

Large diffs are not rendered by default.

27 changes: 23 additions & 4 deletions 01-birthday-reminder/setup/src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
import React, { useState } from 'react';
import data from './data';
import List from './List';
import React, { useState } from "react";
import data from "./data";
import List from "./List";
function App() {
return <h2>reminder project setup</h2>;
const [check, setcheck] = useState(false);
const [people, setpeople] = useState(data);
if (people.length === 0) {
return (
<main>
<section className="container">
<button onClick={() => setpeople(data)}>restore</button>
</section>
</main>
);
}
return (
<main>
<section className="container">
<h3>{people.length} birthdays today</h3>
<List people={people} />
<button onClick={() => setpeople([])}>clear all </button>
</section>
</main>
);
}

export default App;
17 changes: 14 additions & 3 deletions 01-birthday-reminder/setup/src/List.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import React from 'react';
import React from "react";

const List = () => {
const List = ({ people }) => {
return (
<>
<h2>list component</h2>
{people.map((person) => {
const { id, name, age, image } = person;
return (
<article key={id} className="person">
<img src={image} alt="" />
<div>
<p>{name}</p>
<p>{age}</p>
</div>
</article>
);
})}
</>
);
};
Expand Down
8 changes: 4 additions & 4 deletions 01-birthday-reminder/setup/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Global Styles
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
background: var(--clr-pink);
color: var(--clr-grey-9);
line-height: 1.5;
Expand Down Expand Up @@ -141,8 +141,8 @@ main {
}

.container {
width: 90vw;
margin: 5rem 0;
width: 100%;
margin: 0 auto;
max-width: var(--fixed-width);
background: var(--clr-white);
border-radius: var(--radius);
Expand Down
10 changes: 5 additions & 5 deletions 01-birthday-reminder/setup/src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
document.getElementById("root")
);
Loading

0 comments on commit 81870af

Please sign in to comment.