├── .gitignore ├── LICENSE.MD ├── README.MD ├── package.json ├── src ├── app │ ├── components │ │ └── Main.js │ └── index.js └── index.html └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | npm-debug.log 4 | dist -------------------------------------------------------------------------------- /LICENSE.MD: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2016 Maximilian Schwarzmüller 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # ReactJS Basics 2 | 3 | This repository accompanies my ReactJS & CSS Animations - Basics YouTube Series. 4 | 5 | # Usage 6 | Switch to the branch you're interested in (branches = different stages in the series) and compare/ download the source code. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reactjs-basics", 3 | "version": "1.0.0", 4 | "description": "Some basic ReactJS", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "npm run build", 8 | "build": "webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot --history-api-fallback", 9 | "build:prod": "webpack -p && cp src/index.html dist/index.html" 10 | }, 11 | "keywords": [ 12 | "reactjs" 13 | ], 14 | "author": "Maximilian Schwarzmueller", 15 | "license": "MIT", 16 | "dependencies": { 17 | "react": "^15.2.1", 18 | "react-dom": "^15.2.1" 19 | }, 20 | "devDependencies": { 21 | "babel-loader": "^6.2.4", 22 | "babel-preset-es2015": "^6.9.0", 23 | "babel-preset-react": "^6.11.1", 24 | "babel-preset-stage-2": "^6.11.0", 25 | "webpack": "^1.13.1", 26 | "webpack-dev-server": "^1.14.1" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/components/Main.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const styles = { 4 | transition: 'all 1s ease-out' 5 | }; 6 | 7 | export class Main extends React.Component { 8 | constructor() { 9 | super(); 10 | this.state = { 11 | opacity: 1, 12 | scale: 1 13 | }; 14 | } 15 | 16 | onHide() { 17 | this.setState({ 18 | opacity: 0 19 | }); 20 | } 21 | 22 | onScale() { 23 | this.setState({ 24 | scale: this.state.scale > 1 ? 1 : 1.3 25 | }); 26 | } 27 | 28 | render() { 29 | return ( 30 |
31 | 41 |
42 |
43 |
44 | 45 |
46 |
47 | 48 |
49 |
50 |
52 |
53 | Awesome Animations! 54 |

CSS Animations are pretty cool. But combined with ReactJS ... <3

55 |
56 |
57 | HIDE 58 | SCALE 59 |
60 |
61 |
62 |
63 |
64 |
65 | 66 | ); 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /src/app/index.js: -------------------------------------------------------------------------------- 1 | import {render} from "react-dom"; 2 | import React from "react"; 3 | 4 | import {Main} from "./components/Main"; 5 | 6 | render( 7 |
, 8 | window.document.getElementById('app')); -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | ReactJS Basics 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | 3 | var DIST_DIR = path.resolve(__dirname, "dist"); 4 | var SRC_DIR = path.resolve(__dirname, "src"); 5 | 6 | var config = { 7 | entry: SRC_DIR + "/app/index.js", 8 | output: { 9 | path: DIST_DIR + "/app", 10 | filename: "bundle.js", 11 | publicPath: "/app/" 12 | }, 13 | module: { 14 | loaders: [ 15 | { 16 | test: /\.js?/, 17 | include: SRC_DIR, 18 | loader: "babel-loader", 19 | query: { 20 | presets: ["react", "es2015", "stage-2"] 21 | } 22 | } 23 | ] 24 | } 25 | }; 26 | 27 | module.exports = config; --------------------------------------------------------------------------------