(
11 | isAuthenticated
12 | ?
13 | ()
14 | :
15 | ()
16 | )}/>
17 | );
18 |
19 | export default Private;
--------------------------------------------------------------------------------
/Day 11 Redux/src/_reducers/alert.reducer.js:
--------------------------------------------------------------------------------
1 | import { alertConstants } from '../_constants';
2 |
3 | export function alert(state = {}, action) {
4 | switch (action.type) {
5 | case alertConstants.SUCCESS:
6 | return {
7 | type: 'alert-success',
8 | message: action.message
9 | };
10 | case alertConstants.ERROR:
11 | return {
12 | type: 'alert-danger',
13 | message: action.message
14 | };
15 | case alertConstants.CLEAR:
16 | return {};
17 | default:
18 | return state
19 | }
20 | }
--------------------------------------------------------------------------------
/Day 3.0 React Router Intro/src/team.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {Link} from 'react-router-dom';
3 |
4 | export default class Home extends React.Component {
5 | render() {
6 | return (
7 |
8 | -
9 | team1
10 |
11 | -
12 | team1
13 |
14 | -
15 | team2
16 |
17 |
18 | )
19 | }
20 | }
--------------------------------------------------------------------------------
/Day 13 Next JS/components/banner.tsx:
--------------------------------------------------------------------------------
1 | import Link from "next/link";
2 | export default function Header() {
3 | return (
4 |
5 |
6 |
Umbrellas
7 |
8 |
9 | - Target /
10 | - Women /
11 | - Women's Accessories/
12 | - Umbrellas (89)
13 |
14 |
15 |
16 |
17 | )
18 | }
--------------------------------------------------------------------------------
/Day 7.1 Shopping Cart/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Veggy - React Shopping Cart Demo
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Day 12/src/components/Button/Button.css:
--------------------------------------------------------------------------------
1 | .component-button {
2 | display: inline-flex;
3 | width: 25%;
4 | flex: 1 0 auto;
5 | }
6 |
7 | .component-button.wide {
8 | width: 50%;
9 | }
10 |
11 | .component-button button {
12 | background-color: #E0E0E0;
13 | border: 0;
14 | font-size: 12px;
15 | margin: 0 1px 0 0;
16 | flex: 1 0 auto;
17 | padding: 0;
18 | }
19 |
20 | .component-button:last-child button {
21 | margin-right: 0;
22 | }
23 |
24 | .component-button.orange button {
25 | background-color: #F5923E;
26 | color: white;
27 | }
--------------------------------------------------------------------------------
/Day 5.1 Dashboard App/src/views/NewJob/index.js:
--------------------------------------------------------------------------------
1 | import NewJob from './NewJob';
2 | import React, { useContext } from 'react';
3 | import ContainerContext from '../../container/context';
4 | import { withRouter} from 'react-router-dom';
5 |
6 | const AddNewJob = (props) => {
7 | const { addNewJob } = useContext(ContainerContext);
8 | const handleSubmit = (data) => {
9 | console.log(data);
10 | addNewJob(data);
11 | props.history.push('/search');
12 | }
13 | return
14 | }
15 |
16 | export default withRouter(AddNewJob);
17 |
--------------------------------------------------------------------------------
/Day 7.1 Shopping Cart/src/empty-states/NoResults.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 |
3 | const NoResults = () => {
4 | return (
5 |
6 |
7 |

11 |
Sorry, no products matched your search!
12 |
Enter a different keyword and try.
13 |
14 |
15 | );
16 | };
17 |
18 | export default NoResults;
19 |
--------------------------------------------------------------------------------
/Day 13 Next JS/components/CartList.tsx:
--------------------------------------------------------------------------------
1 | import Cart from './Cart';
2 | import { IProduct, IProductProps } from './interface';
3 |
4 | interface IProductListProps {
5 | products: IProduct[],
6 | }
7 |
8 | const CartList = (props: IProductListProps) => {
9 | return (
10 |
11 | {props.products && props.products.length === 0 && No data added in Cart}
12 | {props.products.map((product, index) => )}
13 |
14 | )
15 | }
16 |
17 | export default CartList;
--------------------------------------------------------------------------------
/Day 14 Lazy Load/src/Header.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { Link } from "react-router-dom";
3 |
4 | class Header extends Component {
5 | constructor() {
6 | super();
7 | }
8 |
9 | render() {
10 | return (
11 |
12 |
13 | Home
14 |
15 |
16 | Another Home
17 |
18 |
19 | );
20 | }
21 | }
22 |
23 | export default Header;
24 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "weather-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "axios": "^0.19.2",
7 | "bootstrap": "^4.5.0",
8 | "react": "^16.2.0",
9 | "react-bootstrap": "^1.3.0",
10 | "react-dom": "^16.2.0",
11 | "react-router-dom": "^5.2.0",
12 | "react-scripts": "1.1.0"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test --env=jsdom",
18 | "eject": "react-scripts eject"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Day 12/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "calculator",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "big.js": "^5.0.3",
7 | "react": "^16.2.0",
8 | "react-dom": "^16.2.0",
9 | "react-scripts": "1.0.17"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test --env=jsdom",
15 | "eject": "react-scripts eject"
16 | },
17 | "devDependencies": {
18 | "enzyme": "^3.3.0",
19 | "enzyme-adapter-react-16": "^1.1.1",
20 | "sinon": "^4.4.8"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/client/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Day 5.2 Shopping Cart Redux-2/src/containers/Product.js:
--------------------------------------------------------------------------------
1 | import { connect } from 'react-redux';
2 | import Product from '../components/Product';
3 | import { addToCart, removeFromCart, isInCart } from '../ducks/cart';
4 |
5 | const mapStateToProps = (state, props) => {
6 | return {
7 | isInCart: isInCart(state, props)
8 | }
9 | }
10 |
11 | const mapDispatchToProps = (dispatch) => ({
12 | addToCart: (id) => dispatch(addToCart(id)),
13 | removeFromCart: (id) => dispatch(removeFromCart(id))
14 | })
15 |
16 | export default connect(mapStateToProps, mapDispatchToProps)(Product);
17 |
--------------------------------------------------------------------------------
/Day 3.2 Flicker App/src/components/photos/photos.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './photo';
3 | import './photos.scss';
4 | import Photo from './photo';
5 |
6 | export default function Photos({ type, photos, onImageClick }) {
7 | return (
8 |
9 | {photos.map(photo => (
10 |
16 | ))}
17 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/Day 4.1 Netflix Clone/src/components/partails/serachBar.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from 'react';
2 |
3 | const Search = (props) => {
4 | const [value, setValue] = useState('');
5 | const onSubmit = (e) => {
6 | e.preventDefault();
7 | props.onSubmit(value);
8 | }
9 | const handleChange = (e) => {
10 | setValue(e.target.value);
11 | }
12 | return (
13 |
16 | );
17 | }
18 |
19 | export default Search;
--------------------------------------------------------------------------------
/Day 4.3 Hacker Clone App/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 | import * as serviceWorker from './serviceWorker';
5 | import { HashRouter as Router } from 'react-router-dom';
6 | import 'assets/scss/main.scss';
7 |
8 | ReactDOM.render(, document.getElementById('root'));
9 |
10 | // If you want your app to work offline and load faster, you can change
11 | // unregister() to register() below. Note this comes with some pitfalls.
12 | // Learn more about service workers: http://bit.ly/CRA-PWA
13 | serviceWorker.unregister();
--------------------------------------------------------------------------------
/Day 4.1 Netflix Clone/src/components/ListToggle.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from 'react';
2 |
3 | const ListToggle = (props) => {
4 |
5 | const [toggled, setToggled] = useState(false);
6 | const handleClick = () => {
7 | if(toggled === true) {
8 | setToggled(false);
9 | } else {
10 | setToggled(true);
11 | }
12 | }
13 | return (
14 |
20 | );
21 | }
22 |
23 | export default ListToggle;
--------------------------------------------------------------------------------
/Day 5.1 Dashboard App/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
13 | React App
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Day 2/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/Day 3/src/MessageList.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | class MessageList extends React.Component {
4 | render() {
5 | return (
6 |
7 | {this.props.messages.map((message, index) => {
8 | return (
9 | -
10 |
{message.senderId}
11 | {message.text}
12 |
13 | )
14 | })}
15 |
16 | )
17 | }
18 | }
19 |
20 |
21 | export default MessageList;
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Day 5.2 Shopping Cart Redux-2/src/containers/Cart.js:
--------------------------------------------------------------------------------
1 | import { connect } from 'react-redux';
2 | import Cart from '../components/Cart';
3 | import { getItems, getCurrency, getTotal, removeFromCart } from '../ducks/cart';
4 |
5 | const mapStateToProps = (state, props) => {
6 | return {
7 | items: getItems(state, props),
8 | currency: getCurrency(state, props),
9 | total: getTotal(state, props)
10 | }
11 | }
12 |
13 | const mapDispatchToProps = (dispatch) => ({
14 | removeFromCart: (id) => dispatch(removeFromCart(id))
15 | })
16 |
17 | export default connect(mapStateToProps, mapDispatchToProps)(Cart);
18 |
--------------------------------------------------------------------------------
/Day 10 Redux/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "todo-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@material-ui/core": "^3.0.1",
7 | "@material-ui/icons": "^3.0.1",
8 | "lodash": "^4.17.10",
9 | "react": "^16.4.2",
10 | "react-dom": "^16.4.2",
11 | "react-redux": "^5.0.7",
12 | "react-scripts": "1.1.5",
13 | "redux": "^4.0.0",
14 | "redux-logger": "^3.0.6"
15 | },
16 | "scripts": {
17 | "start": "react-scripts start",
18 | "build": "react-scripts build",
19 | "test": "react-scripts test --env=jsdom",
20 | "eject": "react-scripts eject"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Day 7.1 Shopping Cart/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/server/config/env/all.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const config = {
4 | port: process.env.PORT || 5003,
5 | log: {
6 | //morgan options: 'combined', 'common', 'dev', 'short', 'tiny'
7 | format: 'combined',
8 | //winston config
9 | transports: {
10 | file: {
11 | level: 'debug',
12 | filename: './logs/applog.log',
13 | handleExceptions: true,
14 | json: false,
15 | maxsize: 5242880, //5MB
16 | colorize: false
17 | },
18 | console: {
19 | level: 'debug',
20 | handleExceptions: true,
21 | json: false,
22 | colorize: true
23 | }
24 | }
25 | }
26 | };
27 | export default config;
28 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/server/app/service/user.service.js:
--------------------------------------------------------------------------------
1 |
2 | const User = require('../models/user');
3 |
4 | export async function findByUserName (name) {
5 | return await User.findOne({ userName: name});
6 | }
7 | export async function list({ limit=50,offset=0, ...args} = {}) {
8 | return await User.find({}).populate('posts');
9 | }
10 | export async function findById(UserId) {
11 | return await User.findById(UserId).populate('posts');
12 | }
13 | export async function create(user) {
14 | return await User.create(user);
15 | }
16 | export async function deleteUser(UserId) {
17 | return await User.findByIdAndRemove(UserId);
18 | }
--------------------------------------------------------------------------------
/Day 8 Book Store/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 | Bookseller
13 |
14 |
15 |
16 | Bookseller
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Day 3/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | animation: App-logo-spin infinite 20s linear;
7 | height: 40vmin;
8 | pointer-events: none;
9 | }
10 |
11 | .App-header {
12 | background-color: #282c34;
13 | min-height: 100vh;
14 | display: flex;
15 | flex-direction: column;
16 | align-items: center;
17 | justify-content: center;
18 | font-size: calc(10px + 2vmin);
19 | color: white;
20 | }
21 |
22 | .App-link {
23 | color: #61dafb;
24 | }
25 |
26 | @keyframes App-logo-spin {
27 | from {
28 | transform: rotate(0deg);
29 | }
30 | to {
31 | transform: rotate(360deg);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Day 5 Github Battle/config/polyfills.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (typeof Promise === 'undefined') {
4 | // Rejection tracking prevents a common issue where React gets into an
5 | // inconsistent state due to an error, but it gets swallowed by a Promise,
6 | // and the user has no idea what causes React's erratic future behavior.
7 | require('promise/lib/rejection-tracking').enable();
8 | window.Promise = require('promise/lib/es6-extensions.js');
9 | }
10 |
11 | // Object.assign() is commonly used with React.
12 | // It will use the native implementation if it's present and isn't buggy.
13 | Object.assign = require('object-assign');
14 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/server/config/env/production.js:
--------------------------------------------------------------------------------
1 |
2 | const config = {
3 | db: {
4 | database: 'blog-prod',
5 | username: 'admin-prod',
6 | password: 'admin',
7 | host: 'localhost',
8 | port: 3306,
9 | dialect: 'mysql'
10 | },
11 | log: {
12 | //morgan options: 'combined', 'common', 'dev', 'short', 'tiny'
13 | format: 'combined',
14 | //winston config
15 | transports: {
16 | file: {
17 | level: 'debug',
18 | filename: '../logs/applog.log',
19 | handleExceptions: true,
20 | json: false,
21 | maxsize: 5242880, //5MB
22 | colorize: false
23 | }
24 | }
25 | }
26 | };
27 | export default config;
28 |
--------------------------------------------------------------------------------
/Day 7 YouTube App/config/polyfills.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (typeof Promise === 'undefined') {
4 | // Rejection tracking prevents a common issue where React gets into an
5 | // inconsistent state due to an error, but it gets swallowed by a Promise,
6 | // and the user has no idea what causes React's erratic future behavior.
7 | require('promise/lib/rejection-tracking').enable();
8 | window.Promise = require('promise/lib/es6-extensions.js');
9 | }
10 |
11 | // Object.assign() is commonly used with React.
12 | // It will use the native implementation if it's present and isn't buggy.
13 | Object.assign = require('object-assign');
14 |
--------------------------------------------------------------------------------
/Day 3.1 React Router App/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-router-online-training",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "react": "16.6.3",
7 | "react-dom": "16.6.3",
8 | "react-router-dom": "4.3.1"
9 | },
10 | "devDependencies": {
11 | "react-scripts": "2.1.1"
12 | },
13 | "scripts": {
14 | "start": "react-scripts start",
15 | "build": "react-scripts build",
16 | "test": "react-scripts test --env=jsdom",
17 | "eject": "react-scripts eject"
18 | },
19 | "browserslist": [
20 | ">0.2%",
21 | "not dead",
22 | "not ie <= 11",
23 | "not op_mini all"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/Day 6 Charts/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | animation: App-logo-spin infinite 20s linear;
7 | height: 40vmin;
8 | pointer-events: none;
9 | }
10 |
11 | .App-header {
12 | background-color: #282c34;
13 | min-height: 100vh;
14 | display: flex;
15 | flex-direction: column;
16 | align-items: center;
17 | justify-content: center;
18 | font-size: calc(10px + 2vmin);
19 | color: white;
20 | }
21 |
22 | .App-link {
23 | color: #61dafb;
24 | }
25 |
26 | @keyframes App-logo-spin {
27 | from {
28 | transform: rotate(0deg);
29 | }
30 | to {
31 | transform: rotate(360deg);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Day 3.0 React Router Intro/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-router-online-training",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "react": "16.6.3",
7 | "react-dom": "16.6.3",
8 | "react-router-dom": "4.3.1"
9 | },
10 | "devDependencies": {
11 | "react-scripts": "2.1.1"
12 | },
13 | "scripts": {
14 | "start": "react-scripts start",
15 | "build": "react-scripts build",
16 | "test": "react-scripts test --env=jsdom",
17 | "eject": "react-scripts eject"
18 | },
19 | "browserslist": [
20 | ">0.2%",
21 | "not dead",
22 | "not ie <= 11",
23 | "not op_mini all"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/Day 6 Charts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "new",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "antd": "^3.16.2",
7 | "heatmap.js": "^2.0.5",
8 | "react": "^16.8.6",
9 | "react-dom": "^16.8.6",
10 | "react-scripts": "2.1.8"
11 | },
12 | "scripts": {
13 | "start": "react-scripts start",
14 | "build": "react-scripts build",
15 | "test": "react-scripts test",
16 | "eject": "react-scripts eject"
17 | },
18 | "eslintConfig": {
19 | "extends": "react-app"
20 | },
21 | "browserslist": [
22 | ">0.2%",
23 | "not dead",
24 | "not ie <= 11",
25 | "not op_mini all"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/Day 11 Redux/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-redux-registration-login-example",
3 | "version": "0.0.0",
4 | "private": true,
5 | "dependencies": {
6 | "react": "16.1.1",
7 | "redux": "4.0.0",
8 | "history": "4.7.2",
9 | "react-dom": "16.1.1",
10 | "react-redux": "5.0.7",
11 | "redux-thunk": "2.2.0",
12 | "redux-logger": "3.0.6",
13 | "react-router-dom": "4.2.2"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test --env=jsdom",
19 | "eject": "react-scripts eject"
20 | },
21 | "devDependencies": {
22 | "react-scripts": "latest"
23 | }
24 | }
--------------------------------------------------------------------------------
/Day 13 Next JS/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "strict": false,
12 | "forceConsistentCasingInFileNames": true,
13 | "noEmit": true,
14 | "esModuleInterop": true,
15 | "module": "esnext",
16 | "moduleResolution": "node",
17 | "resolveJsonModule": true,
18 | "isolatedModules": true,
19 | "jsx": "preserve"
20 | },
21 | "exclude": [
22 | "node_modules"
23 | ],
24 | "include": [
25 | "next-env.d.ts",
26 | "**/*.ts",
27 | "**/*.tsx"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/Day 6 Charts/src/Header/header.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {PageHeader} from 'antd';
3 | /* eslint react/no-find-dom-node:0 */
4 | /* react/forbid-prop-types:0 */
5 | class ReactHeatmap extends React.Component {
6 |
7 | constructor(props) {
8 | super(props);
9 | this.state = {
10 | data: null
11 | }
12 | this.handelBack = this.handelBack.bind(this);
13 | }
14 | handelBack(){}
15 |
16 | render() {
17 | return (
18 |
23 | );
24 | }
25 | }
26 |
27 |
28 |
29 | export default ReactHeatmap;
30 |
31 |
--------------------------------------------------------------------------------
/Day 8 Book Store/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bookseller",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "axios": "^0.18.0",
7 | "react": "^16.7.0",
8 | "react-dom": "^16.7.0",
9 | "react-router-dom": "^4.3.1",
10 | "react-scripts": "2.1.2"
11 | },
12 | "scripts": {
13 | "start": "react-scripts start",
14 | "build": "react-scripts build",
15 | "test": "react-scripts test",
16 | "eject": "react-scripts eject"
17 | },
18 | "eslintConfig": {
19 | "extends": "react-app"
20 | },
21 | "browserslist": [
22 | ">0.2%",
23 | "not dead",
24 | "not ie <= 11",
25 | "not op_mini all"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/Day 9 Redux/React Redux App/javascripts/components/Header.js:
--------------------------------------------------------------------------------
1 | import React, { PropTypes, Component } from 'react';
2 | import TodoTextInput from './TodoTextInput';
3 |
4 | class Header extends Component {
5 | handleSave (text) {
6 | if (text.length !== 0) {
7 | this.props.addTodo(text);
8 | }
9 | }
10 | render () {
11 | return (
12 |
13 | todos< /h1>
14 |
15 |
16 | );
17 | }
18 | }
19 |
20 | Header.propTypes = {
21 | addTodo: PropTypes.func.isRequired
22 | };
23 |
24 | export default Header;
--------------------------------------------------------------------------------
/Day 12/src/tests/operate.test.js:
--------------------------------------------------------------------------------
1 | import Big from 'big.js';
2 | import operate from '../logic/operate';
3 |
4 | describe('operate', () => {
5 | it('returns an answer as a String', () => {
6 | const answer = operate(1, 2, '+');
7 | expect(typeof answer).toEqual('string');
8 | });
9 |
10 | it('accepts either strings or numbers as input', () => {
11 | const answer = operate('42', 15, '%');
12 | expect(answer).toEqual('12');
13 | });
14 |
15 | it('throws an error for an improper operation', () => {
16 | const operation = '*';
17 | expect(() => {
18 | operate(4, 90, operation);
19 | }).toThrowError(`Unknown operation ${operation}`);
20 | });
21 | });
--------------------------------------------------------------------------------
/Day 4 Quiz/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-quiz-app",
3 | "version": "0.0.0",
4 | "private": true,
5 | "dependencies": {
6 | "react": "16.1.1",
7 | "redux": "3.7.2",
8 | "react-dom": "16.1.1",
9 | "prop-types": "15.6.1",
10 | "react-redux": "5.0.7"
11 | },
12 | "scripts": {
13 | "start": "react-scripts start",
14 | "build": "react-scripts build",
15 | "test": "react-scripts test --env=jsdom",
16 | "eject": "react-scripts eject"
17 | },
18 | "devDependencies": {
19 | "react-scripts": "latest"
20 | },
21 | "browserslist": [
22 | ">0.2%",
23 | "not dead",
24 | "not ie <= 11",
25 | "not op_mini all"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/Day 12/src/tests/Panel.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Enzyme, { shallow } from 'enzyme';
4 | import Adapter from 'enzyme-adapter-react-16';
5 | import Panel from '../components/Panel/Panel';
6 |
7 | Enzyme.configure({ adapter: new Adapter() });
8 |
9 | describe('', () => {
10 | it('should render a div with class `component-panel`', () => {
11 | const component = shallow();
12 | expect(component.find('.component-panel')).toHaveLength(1);
13 | });
14 |
15 | it('should render 19 buttons', () => {
16 | const component = shallow();
17 | expect(component.find('Button')).toHaveLength(19);
18 | });
19 | });
--------------------------------------------------------------------------------
/Day 7 YouTube App/app/components/video_list_item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const VideoListItem = (props) => {
4 | const imageUrl = props.video.snippet.thumbnails.default.url;
5 |
6 | return (
7 | props.onVideoSelect(props.video)} className="list-group-item">
8 |
9 |
10 |

11 |
12 |
13 |
{props.video.snippet.title}
14 |
15 |
16 |
17 | );
18 | };
19 |
20 | export default VideoListItem;
21 |
--------------------------------------------------------------------------------
/Day 3.1 React Router App/src/login/Login.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Redirect } from 'react-router-dom';
3 | import authHelper from '../helpers/AuthHelper';
4 |
5 | class Login extends React.Component {
6 | constructor(props) {
7 | super(props);
8 | this.state = { redirect: false };
9 | }
10 |
11 | onLoginClick() {
12 | authHelper.authenticate(() => {
13 | this.setState({ redirect: true });
14 | });
15 | }
16 |
17 | render() {
18 | if (this.state.redirect) {
19 | return
20 | }
21 |
22 | return ;
23 | }
24 | }
25 |
26 | export default Login;
27 |
--------------------------------------------------------------------------------
/Day 12/src/logic/operate.js:
--------------------------------------------------------------------------------
1 | import Big from 'big.js';
2 |
3 | function operate(numberOne, numberTwo, operation) {
4 | const one = Big(numberOne);
5 | const two = Big(numberTwo);
6 |
7 | switch(operation) {
8 | case '+':
9 | return one.plus(two).toString();
10 | case '-':
11 | return one.minus(two).toString();
12 | case 'x':
13 | return one.times(two).toString();
14 | case '÷':
15 | return one.div(two).toString();
16 | case '%':
17 | return one.mod(two).toString();
18 | default:
19 | throw Error(`Unknown operation ${operation}`);
20 | }
21 | }
22 |
23 | export default operate;
--------------------------------------------------------------------------------
/Day 7 YouTube App/app/components/search_bar.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | class SearchBar extends Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = { term: '' };
7 | }
8 | handleChange(e){
9 | this.setState({term : e.target.value});
10 | if(this.state.term.length > 3){
11 | this.props.handleChange(this.state.term);
12 | }
13 | }
14 |
15 | render() {
16 | return (
17 |
18 |
21 |
22 | );
23 | }
24 | }
25 |
26 | export default SearchBar;
27 |
--------------------------------------------------------------------------------
/Day 11 Redux/src/_constants/user.constants.js:
--------------------------------------------------------------------------------
1 | export const userConstants = {
2 | REGISTER_REQUEST: 'USERS_REGISTER_REQUEST',
3 | REGISTER_SUCCESS: 'USERS_REGISTER_SUCCESS',
4 | REGISTER_FAILURE: 'USERS_REGISTER_FAILURE',
5 |
6 | LOGIN_REQUEST: 'USERS_LOGIN_REQUEST',
7 | LOGIN_SUCCESS: 'USERS_LOGIN_SUCCESS',
8 | LOGIN_FAILURE: 'USERS_LOGIN_FAILURE',
9 |
10 | LOGOUT: 'USERS_LOGOUT',
11 |
12 | GETALL_REQUEST: 'USERS_GETALL_REQUEST',
13 | GETALL_SUCCESS: 'USERS_GETALL_SUCCESS',
14 | GETALL_FAILURE: 'USERS_GETALL_FAILURE',
15 |
16 | DELETE_REQUEST: 'USERS_DELETE_REQUEST',
17 | DELETE_SUCCESS: 'USERS_DELETE_SUCCESS',
18 | DELETE_FAILURE: 'USERS_DELETE_FAILURE'
19 | };
20 |
--------------------------------------------------------------------------------
/Day 3.2 Flicker App/src/services/giphy-service.js:
--------------------------------------------------------------------------------
1 | const giphyApiUrl = '//api.giphy.com/v1/gifs/search';
2 | const giphyApiKey = 'YoyUyRGt2YenjFvxfq87V5gvNjak2EBQ';
3 |
4 | const format = (img) => {
5 | return {
6 | id: img.id,
7 | url: img.images['original_mp4']
8 | }
9 | };
10 | export const giphySearch = (term) => {
11 | const apiUrl = `${giphyApiUrl}?api_key=${giphyApiKey}&q=${term}`;
12 |
13 | return fetch(apiUrl)
14 | .then(res => res.json())
15 | .then(result => {
16 | return result.data.map((img) => format(img));
17 | })
18 | .catch((err) => {
19 | console.log('error: ', err);
20 | return err;
21 | });
22 | };
23 |
--------------------------------------------------------------------------------
/Day 6 Charts/src/Home/searchBarFilter.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DatePicker from '../common/datePicker';
3 | import SelectDropDowns from '../common/select';
4 |
5 | class SearchBarFilter extends React.Component {
6 |
7 | handleChange(data){
8 | this.props.handleChange(data);
9 | }
10 | handleDataChange(){
11 | this.props.handleDataChange();
12 | }
13 | render() {
14 | return (
15 |
16 |
17 |
18 |
19 | );
20 | }
21 | }
22 |
23 |
24 |
25 | export default SearchBarFilter;
26 |
27 |
--------------------------------------------------------------------------------
/Day 2/src/Training.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './App.css';
3 |
4 | class Training extends React.Component {
5 | state = {
6 | active: false
7 | }
8 | clickHandler(){
9 | const { price, addTotal} = this.props;
10 | this.setState({ active : !this.state.active}, () => {
11 | addTotal(this.state.active ? price: -price)
12 | });
13 | }
14 | render() {
15 | const {name, price} = this.props;
16 | const {active} = this.state;
17 | return (
18 | this.clickHandler()}>
20 | {name} ${price.toFixed(2)}
21 |
22 | );
23 | }
24 | }
25 |
26 | export default Training;
27 |
--------------------------------------------------------------------------------
/Day 5 Github Battle/app/components/overview/pages/repoListItemComponent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 |
4 | const Repo = function (props) {
5 | const Repos = props.repos.map((repo, index) => {
6 | return (
7 |
8 |
# {index}
9 |

10 |
12 |
13 | )
14 | });
15 | return (
16 |
19 | )
20 | }
21 |
22 | export default Repo;
--------------------------------------------------------------------------------
/Day 3.2 Flicker App/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-router-online-training",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "react-router-dom": "4.3.1",
7 | "node-sass": "^4.14.1",
8 | "react": "^16.13.1",
9 | "react-dom": "^16.13.1",
10 | "react-intersection-observer": "^6.2.3"
11 | },
12 | "devDependencies": {
13 | "react-scripts": "2.1.1"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test --env=jsdom",
19 | "eject": "react-scripts eject"
20 | },
21 | "browserslist": [
22 | ">0.2%",
23 | "not dead",
24 | "not ie <= 11",
25 | "not op_mini all"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/Day 7 YouTube App/app/components/video_detail.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const VideoDetail = ({video}) => {
4 | if (!video) {
5 | return Loading...
;
6 | }
7 |
8 | const videoId = video.id.videoId;
9 | const url = `https://www.youtube.com/embed/${videoId}`;
10 |
11 | return (
12 |
13 |
14 |
15 |
16 |
17 |
{video.snippet.title}
18 |
{video.snippet.description}
19 |
20 |
21 | );
22 | };
23 |
24 | export default VideoDetail;
25 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/server/server.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Module dependencies.
4 | */
5 | require('dotenv').config();
6 | const http = require('http');
7 | const logger = require('./app/util/logger');
8 | import App from './express';
9 | /**
10 | * Main application entry file.
11 | * Please note that the order of loading is important.
12 | */
13 | var mongoose = require('mongoose');
14 | console.log(process.env.MONGO)
15 | mongoose.connect(process.env.MONGO, { useNewUrlParser: true } );
16 | // Bootstrap sequelize models
17 | const server = http.createServer(App());
18 |
19 | server.listen(3002 || process.env.PORT, () => {
20 | logger.info('Application started on port ', 3002 || process.env.PORT);
21 | });
22 |
23 | export default server;
24 |
--------------------------------------------------------------------------------
/Day 5.2 Shopping Cart Redux-2/src/components/ProductList/ProductList.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import Product from '../../containers/Product';
4 |
5 | const ProductList = ({ products }) => {
6 | return (
7 |
8 |
Products
9 |
10 | {products.map(product => (
11 | -
12 |
13 |
14 | ))}
15 |
16 |
17 | );
18 | }
19 |
20 | ProductList.propTypes = {
21 | products: PropTypes.array,
22 | }
23 |
24 | export default ProductList;
25 |
--------------------------------------------------------------------------------
/Day 4.3 Hacker Clone App/README.md:
--------------------------------------------------------------------------------
1 | # [Demo](https://nenadv91.github.io/Hacker-news-clone/)
2 |
3 | ## Available Scripts
4 |
5 | In the project directory, you can run:
6 |
7 | ### `npm start`
8 |
9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11 |
12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console.
14 |
15 | ### `npm run build`
16 |
17 | Builds the app for production to the `build` folder.
18 | It correctly bundles React in production mode and optimizes the build for the best performance.
19 |
20 | The build is minified and the filenames include the hashes.
21 | Your app is ready to be deployed!
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Day 4.1 Netflix Clone/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-quiz-app",
3 | "version": "0.0.0",
4 | "private": true,
5 | "dependencies": {
6 | "axios": "^0.19.0",
7 | "jquery": "^3.4.1",
8 | "prop-types": "15.6.1",
9 | "react": "^16.13.1",
10 | "react-dom": "^16.13.1",
11 | "react-redux": "5.0.7",
12 | "redux": "3.7.2"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test --env=jsdom",
18 | "eject": "react-scripts eject"
19 | },
20 | "devDependencies": {
21 | "react-scripts": "latest"
22 | },
23 | "browserslist": [
24 | ">0.2%",
25 | "not dead",
26 | "not ie <= 11",
27 | "not op_mini all"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/Day 9 Redux/ES6 Redux App Books/src/containers/book-detail.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { connect } from 'react-redux';
3 |
4 | class BookDetail extends Component {
5 | render() {
6 | if (!this.props.book) {
7 | return Select a book to get started.
;
8 | }
9 |
10 | return (
11 |
12 |
Details for:
13 |
Title: {this.props.book.title}
14 |
Pages: {this.props.book.pages}
15 |
16 | );
17 | }
18 | }
19 |
20 | function mapStateToProps(state) {
21 | return {
22 | book: state.activeBook
23 | };
24 | }
25 | /*function mapDispatchToProps(dispatch) {
26 | }*/
27 | export default connect(mapStateToProps)(BookDetail);
28 |
--------------------------------------------------------------------------------
/Day 11 Redux/src/_reducers/authentication.reducer.js:
--------------------------------------------------------------------------------
1 | import { userConstants } from '../_constants';
2 |
3 | let user = JSON.parse(localStorage.getItem('user'));
4 | const initialState = user ? { loggedIn: true, user } : {};
5 |
6 | export function authentication(state = initialState, action) {
7 | switch (action.type) {
8 | case userConstants.LOGIN_REQUEST:
9 | return {
10 | loggingIn: true,
11 | user: action.user
12 | };
13 | case userConstants.LOGIN_SUCCESS:
14 | return {
15 | loggedIn: true,
16 | user: action.user
17 | };
18 | case userConstants.LOGIN_FAILURE:
19 | return {};
20 | case userConstants.LOGOUT:
21 | return {};
22 | default:
23 | return state
24 | }
25 | }
--------------------------------------------------------------------------------
/Day 6 Charts/src/common/select.js:
--------------------------------------------------------------------------------
1 | import { Select } from 'antd';
2 | import React from 'react';
3 |
4 | const { Option, OptGroup } = Select;
5 |
6 |
7 |
8 | const selectDropdown = (props) => {
9 | const handleChange = (value)=> {
10 | props.handleChange(value);
11 | }
12 | return (
13 | )
24 | }
25 |
26 | export default selectDropdown;
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/server/app/routes/user.route.js:
--------------------------------------------------------------------------------
1 |
2 | import userCtrl from '../controllers/user.ctrl';
3 | import userValidator from '../validators/user.validator';
4 | import postCtrl from '../controllers/post.ctrl';
5 | import postValidator from '../validators/post.validator';
6 | import * as express from 'express';
7 | const router = express.Router()
8 |
9 | router.route('/').get(userCtrl.list);
10 | router.route('/:userId').get(userCtrl.get);
11 | router.route('/').post([userValidator.reqValidator, userValidator.uniqueValidator, userCtrl.create]);
12 | router.route('/:userId').delete(userCtrl.delete);
13 |
14 | router.route('/:userId/posts')
15 | .get(postCtrl.getPostByUser)
16 | .post([postValidator.reqValidator, postCtrl.create]);
17 |
18 | export default router;
--------------------------------------------------------------------------------
/Day 3.1 React Router App/src/events/EventItem.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Link } from 'react-router-dom';
4 |
5 | const EventItem = (props) => {
6 | return (
7 |
8 | {props.name}
9 |
10 | Szczegóły
11 |
12 | );
13 | };
14 |
15 | EventItem.propTypes = {
16 | id: PropTypes.number.isRequired,
17 | name: PropTypes.string.isRequired,
18 | place: PropTypes.string.isRequired,
19 | date: PropTypes.string.isRequired,
20 | time: PropTypes.string.isRequired,
21 | onDeleteClicked: PropTypes.func.isRequired
22 | };
23 |
24 | export default EventItem;
25 |
--------------------------------------------------------------------------------
/Day 8.2 Hooks/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-hooks",
3 | "version": "0.1.1",
4 | "private": true,
5 | "dependencies": {
6 | "gh-pages": "^2.1.1",
7 | "react": "^16.9.0",
8 | "react-dom": "^16.9.0",
9 | "react-scripts": "^3.1.1"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test",
15 | "eject": "react-scripts eject",
16 | "predeploy": "npm run build",
17 | "deploy": "gh-pages -d build"
18 | },
19 | "eslintConfig": {
20 | "extends": "react-app"
21 | },
22 | "browserslist": [
23 | ">0.2%",
24 | "not dead",
25 | "not ie <= 11",
26 | "not op_mini all"
27 | ],
28 | "homepage": "https://taniarascia.github.io/react-hooks"
29 | }
30 |
--------------------------------------------------------------------------------
/Day 8.1 Hooks Simple Cart/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-hooks",
3 | "version": "0.1.1",
4 | "private": true,
5 | "dependencies": {
6 | "gh-pages": "^2.1.1",
7 | "react": "^16.9.0",
8 | "react-dom": "^16.9.0",
9 | "react-scripts": "^3.1.1"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test",
15 | "eject": "react-scripts eject",
16 | "predeploy": "npm run build",
17 | "deploy": "gh-pages -d build"
18 | },
19 | "eslintConfig": {
20 | "extends": "react-app"
21 | },
22 | "browserslist": [
23 | ">0.2%",
24 | "not dead",
25 | "not ie <= 11",
26 | "not op_mini all"
27 | ],
28 | "homepage": "https://taniarascia.github.io/react-hooks"
29 | }
30 |
--------------------------------------------------------------------------------
/Day 8.3 Hooks Simple Cart-2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-hooks",
3 | "version": "0.1.1",
4 | "private": true,
5 | "dependencies": {
6 | "gh-pages": "^2.1.1",
7 | "react": "^16.9.0",
8 | "react-dom": "^16.9.0",
9 | "react-scripts": "^3.1.1"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test",
15 | "eject": "react-scripts eject",
16 | "predeploy": "npm run build",
17 | "deploy": "gh-pages -d build"
18 | },
19 | "eslintConfig": {
20 | "extends": "react-app"
21 | },
22 | "browserslist": [
23 | ">0.2%",
24 | "not dead",
25 | "not ie <= 11",
26 | "not op_mini all"
27 | ],
28 | "homepage": "https://taniarascia.github.io/react-hooks"
29 | }
30 |
--------------------------------------------------------------------------------
/Day 9 Redux/React Redux App/javascripts/actions/todos.js:
--------------------------------------------------------------------------------
1 | import * as types from '../constants/ActionTypes';
2 |
3 | export function addTodo(text) {
4 | return {
5 | type: types.ADD_TODO,
6 | text : text
7 | };
8 | }
9 |
10 | export function deleteTodo(id) {
11 | return {
12 | type: types.DELETE_TODO,
13 | id : id
14 | };
15 | }
16 |
17 | export function editTodo(id, text) {
18 | return {
19 | type: types.EDIT_TODO,
20 | id,
21 | text
22 | };
23 | }
24 |
25 | export function completeTodo(id) {
26 | return {
27 | type: types.COMPLETE_TODO,
28 | id
29 | };
30 | }
31 |
32 | export function completeAll() {
33 | return {
34 | type: types.COMPLETE_ALL
35 | };
36 | }
37 |
38 | export function clearCompleted() {
39 | return {
40 | type: types.CLEAR_COMPLETED
41 | };
42 | }
--------------------------------------------------------------------------------
/Day 13 Next JS/static/profile.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Day 3.2 Flicker App/README.md:
--------------------------------------------------------------------------------
1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2 |
3 | Basic React gallery app, that let user search images and Gif's on `flicker` and `giphy` service.
4 |
5 | All assets loads with only when needed (just before entering the viewport) with `intersection-observer` (modern browsers only 😎)
6 |
7 |
8 | todo:
9 | * add the ability to select multiple images
10 | * add other sources (`getty` maybe)
11 | * modal that shows the asset on full page
12 | * add [Redux](https://redux.js.org/)
13 | * add [styled-components](https://styled-components.com)
14 | * add `local-storage` support
15 | * store selections on DB
16 | * add authentication
17 | * more and more..
18 |
19 |
20 | demo:
21 | https://adica.github.io/react-flicker-app/
22 |
--------------------------------------------------------------------------------
/Day 10 Redux/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import logo from "./logo.svg";
3 | import "./App.css";
4 | import ToDO from "./pages/todo";
5 | import { Provider as ReduxProvider } from "react-redux";
6 | import configureStore from "./modules/store";
7 |
8 | const reduxStore = configureStore(window.REDUX_INITIAL_DATA);
9 |
10 | class App extends Component {
11 | render() {
12 | return (
13 |
14 |
15 |
16 |
17 | ToDo Redux app
18 |
19 |
20 |
21 |
22 | );
23 | }
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/Day 14 Lazy Load/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "lazy-loading-react-components-with-reactlazy-and-suspense",
3 | "version": "1.0.0",
4 | "description": "Lazy Loading React Components (with react.lazy and suspense)",
5 | "keywords": [],
6 | "main": "src/index.js",
7 | "dependencies": {
8 | "react": "16.12.0",
9 | "react-dom": "16.12.0",
10 | "react-router-dom": "5.1.2",
11 | "react-scripts": "3.0.1"
12 | },
13 | "devDependencies": {
14 | "typescript": "3.3.3"
15 | },
16 | "scripts": {
17 | "start": "react-scripts start",
18 | "build": "react-scripts build",
19 | "test": "react-scripts test --env=jsdom",
20 | "eject": "react-scripts eject"
21 | },
22 | "browserslist": [
23 | ">0.2%",
24 | "not dead",
25 | "not ie <= 11",
26 | "not op_mini all"
27 | ]
28 | }
--------------------------------------------------------------------------------
/Day 5.2 Shopping Cart Redux-2/src/components/Cart/CartItem.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | const CartItem = ({ name, price, currency, onClick }) => {
5 | return (
6 |
7 |
8 |
9 | {name}
10 |
11 |
{price} {currency}
12 |
13 | );
14 | }
15 |
16 | CartItem.propTypes = {
17 | name: PropTypes.string.isRequired,
18 | price: PropTypes.number.isRequired,
19 | currency: PropTypes.string.isRequired,
20 | onClick: PropTypes.func.isRequired
21 | }
22 |
23 | export default CartItem;
24 |
--------------------------------------------------------------------------------
/Day 12/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import Display from './components/Display/Display';
3 | import Panel from './components/Panel/Panel';
4 | import calculate from './logic/calculate';
5 | import './App.css';
6 |
7 | class App extends Component {
8 | state = {
9 | total: '0',
10 | next: null,
11 | operation: null
12 | }
13 |
14 | handleClick = (buttonName) => {
15 | this.setState(calculate(this.state, buttonName));
16 | }
17 |
18 | render() {
19 | return (
20 |
24 | );
25 | }
26 | }
27 |
28 | export default App;
29 |
--------------------------------------------------------------------------------
/Day 12/src/tests/Display.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Enzyme, { shallow } from 'enzyme';
4 | import Adapter from 'enzyme-adapter-react-16';
5 | import Display from '../components/Display/Display';
6 |
7 | Enzyme.configure({ adapter: new Adapter() });
8 |
9 | describe('', () => {
10 | it('should render a div with class `component-display`', () => {
11 | const component = shallow();
12 | expect(component.find('.component-display')).toHaveLength(1);
13 | });
14 |
15 | it('should render whatever value it gets passed', () => {
16 | const component = shallow();
17 | expect(component.contains(
18 |
19 | 6
20 |
21 | )).toEqual(true);
22 | });
23 | });
--------------------------------------------------------------------------------
/Day 4 Quiz/src/components/Result.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | class Result extends React.Component {
4 | constructor(props){
5 | super(props);
6 | }
7 | renderQuestins(){
8 | return this.props.quizResult.map((_data,index) =>{
9 | return {_data.question}
correct answer is option: {_data.answerindex} : and you have selcted {this.props.answers[index]+1} { ((this.props.answers[index]+1) === _data.answerindex) ? (its correct !man) : ''}
10 | })
11 | }
12 | render (){
13 | return (
14 |
15 |
16 |
Lets see your results!
17 |
{this.renderQuestins()}
18 |
19 |
20 | )
21 | }
22 | }
23 |
24 | export default Result;
--------------------------------------------------------------------------------
/Day 4.3 Hacker Clone App/src/components/comments/index.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import Comment from 'components/comment';
3 | import Loading from 'components/loading';
4 |
5 | class Comments extends Component {
6 | render() {
7 | let { data } = this.props;
8 |
9 | if(data === null) {
10 | return
11 | }
12 |
13 | if(data === false) {
14 | return null;
15 | }
16 |
17 | if(!data.length) {
18 | return
20 | No comments found.
21 | }
22 |
23 | return (
24 |
25 | {data.map(comment =>
26 | )}
29 |
30 | )
31 | }
32 | }
33 |
34 | export default Comments
--------------------------------------------------------------------------------
/Day 5.1 Dashboard App/src/views/NewJob/TabPanel.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import Box from '@material-ui/core/Box';
4 | function TabPanel(props) {
5 | const { children, value, index, ...other } = props;
6 |
7 | return (
8 |
21 | );
22 | }
23 |
24 | TabPanel.propTypes = {
25 | children: PropTypes.node,
26 | index: PropTypes.any.isRequired,
27 | value: PropTypes.any.isRequired,
28 | };
29 |
30 | export default TabPanel;
31 |
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/client/src/components/header.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { Navbar } from 'react-bootstrap';
3 | import 'bootstrap/dist/css/bootstrap.min.css';
4 |
5 | class Header extends Component {
6 | render() {
7 | return (
8 |
9 |
10 |
11 |
{' '}
18 | React Bootstrap
19 |
20 |
21 |
22 | );
23 | }
24 | }
25 |
26 | export default Header;
--------------------------------------------------------------------------------
/Day 9 Redux/ES6 Redux App Books/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "redux-simple-starter",
3 | "version": "1.0.0",
4 | "description": "Simple starter package for Redux with React and Babel support",
5 | "main": "index.js",
6 | "repository": "git@github.com",
7 | "scripts": {
8 | "start": "webpack-dev-server --port 3002"
9 | },
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "babel-core": "^6.2.1",
14 | "babel-loader": "^6.2.0",
15 | "babel-preset-es2015": "^6.1.18",
16 | "babel-preset-react": "^6.1.18",
17 | "webpack": "^1.12.9",
18 | "webpack-dev-server": "^1.14.0"
19 | },
20 | "dependencies": {
21 | "babel-preset-stage-1": "^6.1.18",
22 | "react": "^0.14.3",
23 | "react-dom": "^0.14.3",
24 | "react-redux": "^4.0.0",
25 | "redux": "^3.0.4"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Day 4.3 Hacker Clone App/src/assets/scss/components/_comment.scss:
--------------------------------------------------------------------------------
1 | .post-comments {
2 | margin-top: 20px;
3 | }
4 |
5 | .comment {
6 | margin-bottom: 10px;
7 |
8 | .deleted {
9 | color: $text-deleted;
10 | }
11 |
12 | &-date {
13 | margin-left: 5px;
14 | }
15 |
16 | &-info {
17 | color: $text-color-light;
18 | margin-bottom: 3px;
19 | font-size: 11px;
20 |
21 | .comments-toggle {
22 | margin-left: 5px;
23 | }
24 |
25 | >a {
26 | color: $text-color-light;
27 | }
28 |
29 | >span:last-child {
30 | margin-left: 5px;
31 | }
32 | }
33 |
34 | .nested-comments {
35 | margin-top: 20px;
36 | margin-left: 25px;
37 |
38 | @media(max-width: 992px) {
39 | margin-left: 15px;
40 | }
41 |
42 | @media(max-width: 768px) {
43 | margin-left: 10px;
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/Day 5.1 React Blog App/client/src/components/home.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { Jumbotron, Button } from 'react-bootstrap';
3 | import 'bootstrap/dist/css/bootstrap.min.css';
4 |
5 | class Home extends Component {
6 | render() {
7 | return (
8 |
9 |
10 | Hello, world!
11 |
12 | This is a simple hero unit, a simple jumbotron-style component for calling
13 | extra attention to featured content or information.
14 |
15 |
16 |
17 |
18 |
19 |
20 | );
21 | }
22 | }
23 |
24 | export default Home;
--------------------------------------------------------------------------------
/Day 2/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './App.css';
3 | import Training from './Training';
4 | class App extends React.Component {
5 | state = {
6 | total: 0
7 | }
8 | addTotal(price) {
9 | this.setState({
10 | total: this.state.total + price
11 | })
12 | }
13 | render() {
14 | const { trainings } = this.props;
15 | return (
16 | <>
17 | Our Trainings
18 | {
19 | trainings.map((i, index) => {
20 | return this.addTotal(price)}
21 | name={i.name}
22 | price={i.price}
23 | key={index}
24 | active={i.ative} />
25 | })
26 | }
27 | Total ${this.state.total.toFixed(2)}
28 | >
29 | );
30 | }
31 | }
32 |
33 | export default App;
34 |
--------------------------------------------------------------------------------
/Day 9 Redux/React Redux App/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "simple-todo-with-react-and-redux",
3 | "version": "1.0.0",
4 | "description": "simple todo with react and redux",
5 | "main": "index.js",
6 | "repository": {
7 | "type": "git",
8 | "url": "git+ssh://git@github.com/L-movingon/simple-todo-with-react-and.git"
9 | },
10 | "keywords": [
11 | "react",
12 | "todo",
13 | "redux"
14 | ],
15 | "author": "Jason Liao",
16 | "license": "ISC",
17 | "bugs": {
18 | "url": "https://github.com/L-movingon/simple-todo-with-react-and/issues"
19 | },
20 | "dependencies": {
21 | "babel-core": "^5.8.25",
22 | "babel-loader": "^5.3.2",
23 | "classnames": "^2.1.3",
24 | "react": "^0.13.3",
25 | "react-redux": "^2.1.2",
26 | "redux": "^3.0.0",
27 | "todomvc-app-css": "^2.0.1",
28 | "webpack": "^1.12.2"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Day 1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "webpack",
3 | "version": "1.0.0",
4 | "description": "A ready to use simple webpack with react",
5 | "main": "src/index.js",
6 | "scripts": {
7 | "start": "webpack-dev-server --mode development --open",
8 | "build": "webpack --mode production",
9 | "test":"echo hello"
10 | },
11 | "author": "pinglinh",
12 | "license": "ISC",
13 | "devDependencies": {
14 | "babel-core": "^6.26.3",
15 | "babel-loader": "^7.1.5",
16 | "babel-preset-env": "^1.7.0",
17 | "babel-preset-react": "^6.24.1",
18 | "css-loader": "^1.0.0",
19 | "html-webpack-plugin": "^3.2.0",
20 | "style-loader": "^0.23.0",
21 | "webpack": "^4.19.1",
22 | "webpack-cli": "^3.1.1",
23 | "webpack-dev-server": "^3.1.8"
24 | },
25 | "dependencies": {
26 | "react": "^16.5.2",
27 | "react-dom": "^16.5.2"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Day 4.3 Hacker Clone App/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hacker-news-clone",
3 | "version": "0.1.0",
4 | "private": true,
5 | "homepage": ".",
6 | "author": "Nenad Vracar",
7 | "description": "Hacker news website clone with React.",
8 | "dependencies": {
9 | "axios": "^0.18.0",
10 | "moment": "^2.24.0",
11 | "node-sass": "^4.11.0",
12 | "react": "^16.8.2",
13 | "react-dom": "^16.8.2",
14 | "react-router-dom": "^4.3.1",
15 | "react-scripts": "2.1.5"
16 | },
17 | "scripts": {
18 | "start": "react-scripts start",
19 | "build": "react-scripts build",
20 | "test": "react-scripts test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": "react-app"
25 | },
26 | "browserslist": [
27 | ">0.2%",
28 | "not dead",
29 | "not ie <= 11",
30 | "not op_mini all"
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/Day 4.3 Hacker Clone App/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Switch, Route } from 'react-router-dom';
3 |
4 | import Navbar from 'components/navbar';
5 | import Home from 'pages/home';
6 | import Item from 'pages/item';
7 | import User from 'pages/user';
8 | import NotFound from 'pages/404';
9 |
10 |
11 | class App extends Component {
12 | render() {
13 | return (
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | );
26 | }
27 | }
28 |
29 | export default App;
--------------------------------------------------------------------------------
/Day 6 Charts/src/heatMapCharts/changeHeatMapData.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | /* eslint react/no-find-dom-node:0 */
3 | /* react/forbid-prop-types:0 */
4 | class changeHeatMapData extends React.Component {
5 |
6 | render() {
7 | return (
8 |
9 |
Predicted Number of Household destroyed
10 |
11 | - p1
> 100 Houses
12 | - p2
> 200 Houses
13 | - p3
> 300 Houses
14 | - p4
> 500 Houses
15 | - p5
> 1000 Houses
16 |
17 |
18 | );
19 | }
20 | }
21 |
22 | export default changeHeatMapData;
23 |
24 |
--------------------------------------------------------------------------------
/Day 6 Charts/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
18 | React App
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Day 13 Next JS/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nextjs-shop",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "dev": "next",
9 | "build": "next build",
10 | "start": "next start -p 3000"
11 | },
12 | "keywords": [],
13 | "author": "",
14 | "license": "ISC",
15 | "dependencies": {
16 | "@types/next": "^9.0.0",
17 | "@types/react": "^16.9.17",
18 | "@types/react-dom": "^16.9.4",
19 | "@zeit/next-sass": "^1.0.1",
20 | "@zeit/next-typescript": "^1.1.1",
21 | "dotenv": "^8.2.0",
22 | "next": "^9.1.7",
23 | "node-sass": "^4.13.0",
24 | "react": "^16.12.0",
25 | "react-dom": "^16.12.0",
26 | "uuid": "^3.4.0"
27 | },
28 | "devDependencies": {
29 | "@types/node": "^13.1.4",
30 | "typescript": "^3.7.4"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Day 3.2 Flicker App/src/services/flicker-service.js:
--------------------------------------------------------------------------------
1 | const apiKey = 'e38f1bc56d9486ca37e84667b7a98ba8';
2 | const flickerApi = 'https://api.flickr.com/services/rest';
3 |
4 | const format = (img) => {
5 | return {
6 | id: img['id'],
7 | url: `//farm${img.farm}.staticflickr.com/${img.server}/${img.id}_${img.secret}.jpg`
8 | }
9 | };
10 |
11 | export const flickerSearch = (term) => {
12 |
13 | const apiUrl = flickerApi
14 | + `?method=flickr.photos.search&sort=relevance&format=json&nojsoncallback=1&`
15 | + `api_key=${apiKey}&text=${term}`;
16 |
17 | return fetch(apiUrl)
18 | .then(res => res.json())
19 | .then(data => {
20 | return data.photos.photo.map((img) => format(img));
21 | })
22 | .catch((err) => {
23 | console.log('error: ', err);
24 | return err;
25 | });
26 | };
27 |
--------------------------------------------------------------------------------
/Day 13 Next JS/components/interface.tsx:
--------------------------------------------------------------------------------
1 | import { withRouter, Router } from 'next/router';
2 |
3 | export interface IProduct {
4 | id: string
5 | title: string
6 | url: string
7 | description: string
8 | images: IImage
9 | itemId: string,
10 | top_reviews: ITopReviews,
11 | list_price: IPrice,
12 | offer_price: IPrice,
13 | }
14 | interface IImage {
15 | base_url?: string,
16 | primary?: string
17 | }
18 | interface IPrice {
19 | price?: number,
20 | min_price?: number,
21 | max_price?: number,
22 | formatted_price?: number,
23 | price_type: string
24 | }
25 | interface ITopReviews {
26 | user_nickname: string,
27 | title: string,
28 | rating: number,
29 | rating_range: number,
30 | review_text: string,
31 | last_moderated_time: string
32 | }
33 |
34 | export interface IProductProps {
35 | product: IProduct
36 | router: Router
37 | index?: number
38 | }
--------------------------------------------------------------------------------
/Day 5 Github Battle/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Globe App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Day 14 Lazy Load/src/App.js:
--------------------------------------------------------------------------------
1 | import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
2 | import React, { Suspense, lazy } from "react";
3 | import "./App.css";
4 |
5 | import Header from "./Header";
6 | import SuspenseFallback from "./SuspenseFallback";
7 |
8 | const Home = lazy(() => import("./Home"));
9 | const AnotherHome = lazy(() => import("./AnotherHome"));
10 |
11 | function App() {
12 | return (
13 |
14 |
15 |
16 |
17 |
18 | }>
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | );
28 | }
29 |
30 | export default App;
31 |
--------------------------------------------------------------------------------
/Day 5 Github Battle/scripts/test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // Do this as the first thing so that any code reading it knows the right env.
4 | process.env.BABEL_ENV = 'test';
5 | process.env.NODE_ENV = 'test';
6 | process.env.PUBLIC_URL = '';
7 |
8 | // Makes the script crash on unhandled rejections instead of silently
9 | // ignoring them. In the future, promise rejections that are not handled will
10 | // terminate the Node.js process with a non-zero exit code.
11 | process.on('unhandledRejection', err => {
12 | throw err;
13 | });
14 |
15 | // Ensure environment variables are read.
16 | require('../config/env');
17 |
18 | const jest = require('jest');
19 | const argv = process.argv.slice(2);
20 |
21 | // Watch unless on CI or in coverage mode
22 | if (!process.env.CI && argv.indexOf('--coverage') < 0) {
23 | argv.push('--watch');
24 | }
25 |
26 |
27 | jest.run(argv);
28 |
--------------------------------------------------------------------------------
/Day 7 YouTube App/scripts/test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // Do this as the first thing so that any code reading it knows the right env.
4 | process.env.BABEL_ENV = 'test';
5 | process.env.NODE_ENV = 'test';
6 | process.env.PUBLIC_URL = '';
7 |
8 | // Makes the script crash on unhandled rejections instead of silently
9 | // ignoring them. In the future, promise rejections that are not handled will
10 | // terminate the Node.js process with a non-zero exit code.
11 | process.on('unhandledRejection', err => {
12 | throw err;
13 | });
14 |
15 | // Ensure environment variables are read.
16 | require('../config/env');
17 |
18 | const jest = require('jest');
19 | const argv = process.argv.slice(2);
20 |
21 | // Watch unless on CI or in coverage mode
22 | if (!process.env.CI && argv.indexOf('--coverage') < 0) {
23 | argv.push('--watch');
24 | }
25 |
26 |
27 | jest.run(argv);
28 |
--------------------------------------------------------------------------------
/Day 10 Redux/src/modules/reducer.js:
--------------------------------------------------------------------------------
1 | import ACTIONS from "./action";
2 | import _ from "lodash";
3 |
4 | const defaultState = {
5 | items: []
6 | };
7 |
8 | const todoReducer = (state = defaultState, action) => {
9 | switch (action.type) {
10 | case ACTIONS.Types.CREATE_ITEM: {
11 | console.log(action);
12 |
13 | let item = action.payload;
14 | let newItem = { id: state.items.length + 1, description: item };
15 | let newState = _.cloneDeep(state);
16 | newState.items.push(newItem);
17 | return newState;
18 | }
19 |
20 | case ACTIONS.Types.DELETE_ITEM: {
21 | let newState = _.cloneDeep(state);
22 | let index = _.findIndex(newState.items, { id: action.payload });
23 | newState.items.splice(index, 1);
24 | return newState;
25 | }
26 |
27 | default:
28 | return state;
29 | }
30 | };
31 |
32 | export default todoReducer;
33 |
--------------------------------------------------------------------------------
/Day 2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hello-world",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.5.0",
8 | "@testing-library/user-event": "^7.2.1",
9 | "react": "^16.13.1",
10 | "react-dom": "^16.13.1",
11 | "react-scripts": "3.4.1"
12 | },
13 | "scripts": {
14 | "start": "react-scripts start",
15 | "build": "react-scripts build",
16 | "test": "react-scripts test",
17 | "eject": "react-scripts eject"
18 | },
19 | "eslintConfig": {
20 | "extends": "react-app"
21 | },
22 | "browserslist": {
23 | "production": [
24 | ">0.2%",
25 | "not dead",
26 | "not op_mini all"
27 | ],
28 | "development": [
29 | "last 1 chrome version",
30 | "last 1 firefox version",
31 | "last 1 safari version"
32 | ]
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Day 7 YouTube App/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Online Training and Youtube Videos
9 |
10 | Group Me
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Day 5.1 Dashboard App/src/views/Dashboard/Dashboard.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { makeStyles } from '@material-ui/styles';
3 | import { Grid } from '@material-ui/core';
4 | import TableContainer from '../../packages/reusable/Table';
5 | import ChartContainer from '../../packages/reusable/PieChart';
6 |
7 | const useStyles = makeStyles(theme => ({
8 | root: {
9 | padding: theme.spacing(4)
10 | }
11 | }));
12 |
13 | const Dashboard = () => {
14 | const classes = useStyles();
15 |
16 | return (
17 |
18 |
22 |
29 |
30 |
31 |
32 |
33 | );
34 | };
35 |
36 | export default Dashboard;
37 |
--------------------------------------------------------------------------------
/Day 11 Redux/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | React + Redux - User Registration and Login Example & Tutorial
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/Day 5.2 Shopping Cart Redux-2/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 | import { Provider } from 'react-redux';
4 | import { combineReducers, createStore } from 'redux';
5 | import cartReducer from './ducks/cart';
6 | import productsReducer from './ducks/products';
7 | import App from './App';
8 | import productsData from './data/products';
9 | import 'bootstrap/dist/css/bootstrap.css';
10 |
11 | const rootReducer = combineReducers({
12 | cart: cartReducer,
13 | products: productsReducer
14 | });
15 |
16 | let store = createStore(
17 | rootReducer,
18 | {
19 | products: productsData // initial store values
20 | },
21 | window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() // for debugging
22 | );
23 |
24 | render(
25 |
26 |
27 | ,
28 | document.getElementById('root')
29 | );
30 |
--------------------------------------------------------------------------------
/Day 4.1 Netflix Clone/src/components/partails/hero.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const Hero = (props) => {
4 |
5 | return (
6 |
7 |
8 |

9 |
Season 2 now available
10 |
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque id quam sapiente unde voluptatum alias vero debitis, magnam quis quod.
11 |
15 |
16 |
17 |
18 | );
19 | }
20 | export default Hero;
21 |
--------------------------------------------------------------------------------
/Day 12/src/components/Button/Button.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import './Button.css';
4 |
5 | class Button extends Component {
6 | handleClick = () => {
7 | this.props.clickHandler(this.props.name);
8 | }
9 |
10 | render() {
11 | const classNames = [
12 | 'component-button',
13 | this.props.orange ? 'orange' : '',
14 | this.props.wide ? 'wide' : '',
15 | ];
16 | return (
17 |
18 |
21 |
22 | );
23 | }
24 | }
25 |
26 | Button.propTypes = {
27 | name: PropTypes.string,
28 | orange: PropTypes.bool,
29 | wide: PropTypes.bool,
30 | clickHandler: PropTypes.func,
31 | };
32 |
33 | export default Button;
--------------------------------------------------------------------------------
/Day 8.2 Hooks/src/forms/AddUserForm.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 |
3 | const AddUserForm = props => {
4 | const initialFormState = { id: null, name: '', username: '' }
5 | const [ user, setUser ] = useState(initialFormState)
6 |
7 | const handleInputChange = event => {
8 | const { name, value } = event.target
9 |
10 | setUser({ ...user, [name]: value })
11 | }
12 |
13 | return (
14 |
29 | )
30 | }
31 |
32 | export default AddUserForm
33 |
--------------------------------------------------------------------------------
/Day 9 Redux/React Redux App/javascripts/containers/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react';
2 | import { bindActionCreators } from 'redux';
3 | import { connect } from 'react-redux';
4 | import Header from '../components/Header';
5 | import MainSection from '../components/MainSection';
6 | import * as TodoActions from '../actions/todos';
7 |
8 | class App extends Component {
9 | render () {
10 | const { todos, dispatch } = this.props;
11 | const actions = bindActionCreators(TodoActions, dispatch);
12 |
13 | return (
14 |
15 |
16 |
17 |
18 | );
19 | }
20 | }
21 |
22 | App.PropTypes = {
23 | todos: PropTypes.array.isRequired,
24 | dispatch: PropTypes.func.isRequired
25 | };
26 |
27 | function mapStateToProps (state) {
28 | return {
29 | todos: state.todos
30 | }
31 | }
32 |
33 | export default connect(mapStateToProps)(App);
--------------------------------------------------------------------------------
/Day 3/config/jest/fileTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 |
5 | // This is a custom Jest transformer turning file imports into filenames.
6 | // http://facebook.github.io/jest/docs/en/webpack.html
7 |
8 | module.exports = {
9 | process(src, filename) {
10 | const assetFilename = JSON.stringify(path.basename(filename));
11 |
12 | if (filename.match(/\.svg$/)) {
13 | return `const React = require('react');
14 | module.exports = {
15 | __esModule: true,
16 | default: ${assetFilename},
17 | ReactComponent: React.forwardRef((props, ref) => ({
18 | $$typeof: Symbol.for('react.element'),
19 | type: 'svg',
20 | ref: ref,
21 | key: null,
22 | props: Object.assign({}, props, {
23 | children: ${assetFilename}
24 | })
25 | })),
26 | };`;
27 | }
28 |
29 | return `module.exports = ${assetFilename};`;
30 | },
31 | };
32 |
--------------------------------------------------------------------------------
/Day 7.1 Shopping Cart/src/components/Footer.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 |
3 | const Footer = props => {
4 | return (
5 |
30 | );
31 | };
32 |
33 | export default Footer;
34 |
--------------------------------------------------------------------------------
/Day 13 Next JS/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import Link from "next/link";
2 | import { useContext } from 'react';
3 | import CartContext from './CartContext';
4 |
5 | export default function Header() {
6 | const { cart, toggleView } = useContext(CartContext);
7 |
8 | return (
9 |
27 | )
28 | }
--------------------------------------------------------------------------------