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

Lesson 3.1 #40

Open
wants to merge 17 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
Binary file added .DS_Store
Binary file not shown.
File renamed without changes.
23 changes: 23 additions & 0 deletions lesson_1.1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
16,446 changes: 16,446 additions & 0 deletions lesson_1.1/package-lock.json

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions lesson_1.1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "lesson_1.1",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.6.0",
"@emotion/styled": "^11.6.0",
"@material-ui/core": "^4.12.3",
"@mui/icons-material": "^5.1.0",
"@mui/material": "^5.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added lesson_1.1/public/favicon.ico
Binary file not shown.
35 changes: 35 additions & 0 deletions lesson_1.1/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body >
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
42 changes: 42 additions & 0 deletions lesson_1.1/src/AddTodoForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React, { useState } from "react";
import InputWithLabel from "./InputWithLabel";
import Button from '@mui/material/Button'
import AddBoxIcon from '@mui/icons-material/AddBox';
// import AddBoxOutlinedIcon from '@mui/icons-material/AddBoxOutlined';
// import { style } from "@mui/system";
import style from './AddTodoForm.module.css'


function AddTodoForm({ onAddTodo }) {
const [todoTitle, setTodoTitle] = useState("");

const handleTitleChange = (event) => {
const newTodoTitle = event.target.value
setTodoTitle(newTodoTitle);
};

function handleAddTodo(event) {
event.preventDefault();
console.log(todoTitle);
onAddTodo({fields: { Title: todoTitle }});
setTodoTitle("");
}
return (
<div className={style.inputLabel} >
<form onSubmit={handleAddTodo}>
<InputWithLabel
todoTitle={todoTitle}
handleTitleChange={handleTitleChange}
>
Title:
</InputWithLabel>
&nbsp;
<Button className={style.addBtn} onClick={() => console.log('you clicked me')} type="submit">
<AddBoxIcon fontSize='medium'/>
</Button>
</form>
</div>
);
}

export default AddTodoForm;
34 changes: 34 additions & 0 deletions lesson_1.1/src/AddTodoForm.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.inputLabel {
text-align: center;
align-items: center;
color:white;

}
.item {
display: flex;
width: fit-content;
height: 1.2rem;
color: white;

}
.addBtn{
transform: scale(1.4);


}
.inputfield {
border:1px solid #171212;
background-color:rgb(209, 195,195);
border-radius:500px;
font-size: 15px;
width:18%

}
@media screen and (max-width: 400px) {
.inputfield {
width: 68%;
}
.inputLabel{
font-size: 30px;
}
}
63 changes: 63 additions & 0 deletions lesson_1.1/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from 'react';
import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
import TodoContainer from './TodoContainer';
import style from './App.module.css'
import HomeRoundedIcon from '@mui/icons-material/HomeRounded';
import SchoolRoundedIcon from '@mui/icons-material/SchoolRounded';
import VolunteerActivismRoundedIcon from '@mui/icons-material/VolunteerActivismRounded';
import PersonRoundedIcon from '@mui/icons-material/PersonRounded';
import CTDimg from './img/CTD.png'



function App() {
return (
<BrowserRouter>

<nav >

<ul className={style.navUl}>
<li className={style.navLi}>
<Link to="/" className={style.navHref}><HomeRoundedIcon color="primary"/>Home</Link>
</li>
<li className={style.navLi}>
<Link to="/list-1" className={style.navHref}><SchoolRoundedIcon color="primary"/>CTD</Link>
</li>

<li className={style.navLi}>
<Link to="/list-2" className={style.navHref}><VolunteerActivismRoundedIcon color="primary"/>Mentor</Link>
</li>
<li className={style.navLi}>
<Link to="/list-3" className={style.navHref}><PersonRoundedIcon color="primary"/>Personal</Link>
</li>
</ul>

</nav>


<Switch>

<Route path="/list-1">
<TodoContainer tableName="CTD"/>
</Route>
<Route path="/list-2">
<TodoContainer tableName="Mentor"/>
</Route>
<Route path="/list-3">
< TodoContainer tableName="Personal"/>
</Route>
<Route path="/">
<p>select a list...</p>
<div className="CTDimg">
<a target="_blank" href="CTD.png">
<img className={style.CTDimg} src={CTDimg} alt="headerimg" />
</a>
</div>
</Route>
</Switch>

</BrowserRouter>

);
}
export default App;
65 changes: 65 additions & 0 deletions lesson_1.1/src/App.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.navUl {
background-color:#000;
width: 400px;
height: 300px;
margin: 20px;
display: flex;
flex-grow: 2;
list-style: none;
justify-content: space-between;
flex-wrap: wrap;
text-align: center;
}
.navLi {
color: white;
border: 2px solid rgb(61, 61, 59);
border-radius: 35px;
height: 100px;
width: 100px;
padding: 10px;
font-size: 25px;
font-style: italic;
margin-right: 10px;
margin-top: 30px;
flex: 2 0 33%;
}

.navHref {
text-align: center;
padding: 50px 50px;
text-decoration: none;
color: white;
}
.CTDimg {
margin-left: 550px;
display: block;
width: 750px;
height: 600px;
margin-top: -250px;
}

@media screen and (max-width: 800px) {
.navUl {
width: 300px;
}
.navLi {
height: 50px;
width: 50px;
}
}
@media screen and (max-width: 400px) {
.navUl {
width: 150px;

}
.navLi {
height: 25px;
font-size: 20px;
display: flex;
flex-shrink: 1;
border: none;
text-decoration: none;
margin:0;

}
}
27 changes: 27 additions & 0 deletions lesson_1.1/src/InputWithLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { useEffect, useRef } from "react";
import './index.css'
import style from './AddTodoForm.module.css'


function InputWithLabel({ children, handleTitleChange, todoTitle }) {
const inputRef = useRef();
useEffect(() => {
if (inputRef.current) {
inputRef.current.focus();
}
});
return (
<>
<label className={style.formLabel} htmlFor="todoTitle">{children} </label>
<input className={style.inputfield}
ref={inputRef}
onChange={handleTitleChange}
value={todoTitle}
name="title"
id="todoTitle"
></input>
</>
);
}

export default InputWithLabel;
Loading