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

created a tour project using context Api #81

Open
wants to merge 1 commit into
base: master
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
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