├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html └── manifest.json └── src ├── App.css ├── App.js ├── components ├── Nav.js └── styles.css ├── index.css ├── index.js ├── pages ├── AntDesign │ ├── index.js │ └── style.css ├── ExampleCss │ ├── index.js │ └── style.css ├── ReactAnimations │ ├── index.js │ ├── item.js │ ├── style.css │ └── test.js ├── ReactMotion │ └── index.js ├── ReactReveal │ └── index.js └── ReactTransitionGroup │ ├── button.js │ ├── index.js │ ├── item.js │ └── style.css └── serviceWorker.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | config.js 4 | node_modules/* 5 | tmp/* 6 | lib/* 7 | logs/* 8 | dump.rdb 9 | *.zip 10 | *.log 11 | ng-app.js 12 | Makefile.go 13 | .module-cache 14 | webpanel/node_modules/* 15 | webpanel/public/* 16 | functions/node_modules/* 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-animation-2019 2 | Example repo for article [5 Ways to animate a ReactJs app in 2019.](https://medium.com/p/56eb9af6e3bf) 3 | 4 | [Demo](https://nozhenkod.github.io/react-animation-2019) 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-animation-2019", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "antd": "^3.11.4", 7 | "react": "^16.7.0", 8 | "react-dom": "^16.7.0", 9 | "react-scripts": "2.1.1", 10 | "react-transition-group": "^1.2.1" 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 | "homepage": "https://nozhenkod.github.io/react-animation-2019", 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 | "devDependencies": { 29 | "random-name": "^0.1.2", 30 | "rc-tween-one": "2.2.22", 31 | "react-animations": "^1.0.0", 32 | "react-motion": "^0.5.2", 33 | "react-reveal": "1.2.2", 34 | "react-router": "4.3.1", 35 | "react-router-dom": "4.3.1", 36 | "styled-components": "^4.1.3" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NozhenkoD/react-animation-2019/e2fd6fc5b40e5a01e9f7c95c356bd12be82ebadd/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 22 | React App 23 | 24 | 25 | 26 | 29 |
30 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /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 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | background: #ececec; 4 | } 5 | 6 | #root { 7 | height: 100%; 8 | } 9 | 10 | .ant-list-item-content-single { 11 | justify-content: space-between; 12 | align-items: center; 13 | } 14 | 15 | .ant-list-item { 16 | background: #fff; 17 | border-radius: 5px; 18 | padding: 10px 15px; 19 | margin-bottom: 15px; 20 | } 21 | 22 | .ant-list-item .anticon { 23 | cursor: pointer; 24 | padding: 5px; 25 | transition: .3s; 26 | } 27 | 28 | .ant-list-item .anticon:hover { 29 | color: #1890ff; 30 | } 31 | 32 | .main-content { 33 | display: flex; 34 | flex-wrap: wrap; 35 | height: 100%; 36 | padding-top: 61px; 37 | } 38 | 39 | .wrapper-react-animations { 40 | display: flex; 41 | align-items: center; 42 | justify-content: center; 43 | width: 100%; 44 | } 45 | 46 | .wrapper-ant-design { 47 | display: flex; 48 | justify-content: center; 49 | width: 100%; 50 | } 51 | 52 | 53 | @media screen and (max-width: 768px) { 54 | .main-content { 55 | padding: 0; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import { BrowserRouter as Router, Route, Link } from "react-router-dom"; 3 | import ReactTransitionGroup from './pages/ReactTransitionGroup'; 4 | import ReactAnimations from './pages/ReactAnimations'; 5 | import ReactMotion from './pages/ReactMotion'; 6 | import ExampleCss from './pages/ExampleCss'; 7 | import ReactReveal from './pages/ReactReveal'; 8 | import AntDesign from './pages/AntDesign'; 9 | import "antd/dist/antd.css"; 10 | import './App.css'; 11 | import Nav from './components/Nav'; 12 | 13 | class App extends Component { 14 | render() { 15 | return ( 16 | 17 | {/*
*/} 18 | {/**/} 19 | {/*
*/} 20 | {/**/} 21 | {/**/} 22 | {/**/} 23 | {/**/} 24 | 25 |
26 |
33 |
34 |
35 | ); 36 | } 37 | } 38 | 39 | export default App; 40 | -------------------------------------------------------------------------------- /src/components/Nav.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import { Link } from "react-router-dom"; 3 | 4 | import './styles.css'; 5 | 6 | class App extends Component { 7 | render() { 8 | return ( 9 | 10 |
11 |
12 | ReactAnimations 13 | ReactReveal 14 | ExampleCss 15 | ReactTransitionGroup 16 | AntDesign 17 |
18 | GitHub 19 |
20 |
21 | ); 22 | } 23 | } 24 | 25 | export default App; 26 | -------------------------------------------------------------------------------- /src/components/styles.css: -------------------------------------------------------------------------------- 1 | .header { 2 | position: fixed; 3 | left: 0; 4 | top: 0; 5 | right: 0; 6 | width: 100%; 7 | display: flex; 8 | align-items: center; 9 | justify-content: space-between; 10 | background: #222; 11 | z-index: 1; 12 | border-bottom: 1px solid #111; 13 | } 14 | 15 | .header-nav { 16 | display: flex; 17 | } 18 | 19 | .header-nav__item { 20 | padding: 20px; 21 | } 22 | 23 | a.header-nav__item { 24 | color: #ee9a00; 25 | transition: .3s; 26 | } 27 | 28 | a.header__link { 29 | color: #fafafa; 30 | transition: .3s; 31 | } 32 | 33 | a.header-nav__item:hover, 34 | a.header__link:hover { 35 | opacity: .85; 36 | } 37 | 38 | .header__link { 39 | padding: 20px; 40 | } 41 | 42 | @media screen and (max-width: 768px) { 43 | .header { 44 | flex-direction: column; 45 | position: relative; 46 | } 47 | .header-nav { 48 | display: flex; 49 | flex-wrap: wrap; 50 | align-items: center; 51 | justify-content: center; 52 | } 53 | .header-nav__item, .header__link { 54 | padding: 10px; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: http://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /src/pages/AntDesign/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TweenOne from 'rc-tween-one'; 3 | import PathPlugin from 'rc-tween-one/lib/plugin/PathPlugin'; 4 | 5 | TweenOne.plugins.push(PathPlugin); 6 | const duration = 7000; 7 | const ease = 'easeInOutSine'; 8 | const p = 9 | 'M123.5,89.5 C148,82.5 239.5,48.5 230,17.5 C220.5,-13.5 127,6 99.5,13.5 C72,21 -9.5,56.5 1.5,84.5 C12.5,112.5 99,96.5 123.5,89.5 Z'; 10 | const easePath = 11 | 'M0,100 C7.33333333,89 14.3333333,81.6666667 21,78 C25.3601456,75.6019199 29.8706084,72.9026327 33,70 C37.0478723,66.2454406 39.3980801,62.0758689 42.5,57 C48,46.5 61.5,32.5 70,28 C77.5,23.5 81.5,20 86.5,16 C89.8333333,13.3333333 94.3333333,8 100,0'; 12 | const loop = { 13 | yoyo: true, 14 | repeat: -1, 15 | duration, 16 | ease, 17 | }; 18 | const animate = { 19 | redSquare: { 20 | ...loop, 21 | y: 15, 22 | duration: 3000, 23 | delay: 200, 24 | }, 25 | greenBall: { 26 | path: { x: p, y: p }, 27 | duration: 5000, 28 | repeat: -1, 29 | ease: TweenOne.easing.path(easePath, { lengthPixel: 400 }), 30 | }, 31 | track: { 32 | ...loop, 33 | rotate: 15, 34 | }, 35 | }; 36 | 37 | 38 | export default function BannerImage() { 39 | return ( 40 |
41 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 61 | 62 | 63 | 64 | 65 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 88 | 89 | 90 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 |
107 | ); 108 | } 109 | -------------------------------------------------------------------------------- /src/pages/AntDesign/style.css: -------------------------------------------------------------------------------- 1 | /** {*/ 2 | /*box-sizing: border-box;*/ 3 | /*}*/ 4 | 5 | .wrapper { 6 | display: flex; 7 | width: 100%; 8 | height: 100%; 9 | transition: margin .5s; 10 | margin: 0 0 0 -250px; 11 | } 12 | 13 | .wrapper.is-nav-open { 14 | margin-left: 0; 15 | } 16 | 17 | .nav { 18 | position: relative; 19 | width: 250px; 20 | height: 100%; 21 | padding: 20px; 22 | border-right: 1px solid #ccc; 23 | } 24 | 25 | .nav__icon { 26 | position: absolute; 27 | top: 0; 28 | right: -60px; 29 | padding: 20px; 30 | font-size: 20px; 31 | cursor: pointer; 32 | transition: color .3s; 33 | } 34 | 35 | .nav__icon:hover { 36 | color: #5eb2ff; 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/pages/ExampleCss/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Icon } from 'antd'; 3 | import './style.css'; 4 | 5 | export default class ExampleCss extends Component { 6 | constructor(props) { 7 | super(props); 8 | this.wrapperRef = React.createRef(); 9 | } 10 | 11 | handleClick() { 12 | const wrapper = this.wrapperRef.current; 13 | wrapper.classList.toggle('is-nav-open') 14 | } 15 | 16 | render() { 17 | return ( 18 |
19 |
20 | this.handleClick()} /> 21 |
22 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae ducimus est laudantium libero nam omnis optio repellat sit unde voluptatum? 23 |
24 |
25 |
26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/pages/ExampleCss/style.css: -------------------------------------------------------------------------------- 1 | /** {*/ 2 | /*box-sizing: border-box;*/ 3 | /*}*/ 4 | 5 | .wrapper { 6 | display: flex; 7 | width: 100%; 8 | height: 100%; 9 | transition: margin .5s; 10 | margin: 0 0 0 -250px; 11 | } 12 | 13 | .wrapper.is-nav-open { 14 | margin-left: 0; 15 | } 16 | 17 | .nav { 18 | position: relative; 19 | width: 250px; 20 | height: 100%; 21 | padding: 20px; 22 | border-right: 1px solid #ccc; 23 | } 24 | 25 | .nav__icon { 26 | position: absolute; 27 | top: 0; 28 | right: -60px; 29 | padding: 20px; 30 | font-size: 20px; 31 | cursor: pointer; 32 | transition: color .3s; 33 | } 34 | 35 | .nav__icon:hover { 36 | color: #5eb2ff; 37 | } 38 | -------------------------------------------------------------------------------- /src/pages/ReactAnimations/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import styled, { keyframes } from 'styled-components'; 3 | import { 4 | bounce, 5 | bouceIn, 6 | bouceOut, 7 | bounceInDown, 8 | bounceInLeft, 9 | bounceInRight, 10 | bounceInUp, 11 | bounceOutDown, 12 | bounceOutLeft, 13 | bounceOutRight, 14 | bounceOutUp, 15 | fadeIn, 16 | fadeInDown, 17 | fadeInDownBig, 18 | fadeInLeft, 19 | fadeInLeftBig, 20 | fadeInRight, 21 | fadeInRightBig, 22 | fadeInUp, 23 | fadeInUpBig, 24 | fadeOut, 25 | fadeOutDown, 26 | fadeOutDownBig, 27 | fadeOutLeft, 28 | fadeOutLeftBig, 29 | fadeOutRight, 30 | fadeOutRightBig, 31 | fadeOutUp, 32 | fadeOutUpBig, 33 | flash, 34 | flip, 35 | flipInX, 36 | flipInY, 37 | flipOutX, 38 | flipOutY, 39 | headShake, 40 | hinge, 41 | jello, 42 | lightSpeedIn, 43 | lightSpeedOut, 44 | pulse, 45 | rollIn, 46 | rollOut, 47 | rotateIn, 48 | rotateInDownLeft, 49 | rotateInDownRight, 50 | rotateInUpLeft, 51 | rotateInUpRight, 52 | rotateOut, 53 | rotateOutDownLeft, 54 | rotateOutDownRight, 55 | rotateOutUpLeft, 56 | rotateOutUpRight, 57 | rubberBand, 58 | shake, 59 | slideInDown, 60 | slideInLeft, 61 | slideInRight, 62 | slideInUp, 63 | slideOutDown, 64 | slideOutLeft, 65 | slideOutRight, 66 | slideOutUp, 67 | swing, 68 | tada, 69 | wobble, 70 | zoomIn, 71 | zoomInDown, 72 | zoomInLeft, 73 | zoomInRight, 74 | zoomInUp, 75 | zoomOut, 76 | zoomOutDown, 77 | zoomOutLeft, 78 | zoomOutRight, 79 | zoomOutUp, 80 | } from 'react-animations'; 81 | import Item from './item'; 82 | import './style.css'; 83 | 84 | // import { bounce } from 'react-animations' 85 | // const Bounce = styled.div`animation: 2s ${keyframes`${bounce}`} infinite`; 86 | //

Hello Animation Bounce

87 | 88 | const Bounce = styled.div`animation: 2s ${keyframes`${bounce}`} infinite`; 89 | const BounceIn = styled.div`animation: 2s ${keyframes`${bouceIn}`} infinite`; 90 | const BouceOut = styled.div`animation: 2s ${keyframes`${bouceOut}`} infinite`; 91 | const BounceInDown = styled.div`animation: 2s ${keyframes`${bounceInDown}`} infinite`; 92 | const BounceInLeft = styled.div`animation: 2s ${keyframes`${bounceInLeft}`} infinite`; 93 | const BounceInRight = styled.div`animation: 2s ${keyframes`${bounceInRight}`} infinite`; 94 | const BounceInUp = styled.div`animation: 2s ${keyframes`${bounceInUp}`} infinite`; 95 | const BounceOutDown = styled.div`animation: 2s ${keyframes`${bounceOutDown}`} infinite`; 96 | const BounceOutLeft = styled.div`animation: 2s ${keyframes`${bounceOutLeft}`} infinite`; 97 | const BounceOutRight = styled.div`animation: 2s ${keyframes`${bounceOutRight}`} infinite`; 98 | const BounceOutUp = styled.div`animation: 2s ${keyframes`${bounceOutUp}`} infinite`; 99 | const FadeIn = styled.div`animation: 2s ${keyframes`${fadeIn}`} infinite`; 100 | const FadeInDown = styled.div`animation: 2s ${keyframes`${fadeInDown}`} infinite`; 101 | const FadeInDownBig = styled.div`animation: 2s ${keyframes`${fadeInDownBig}`} infinite`; 102 | const FadeInLeft = styled.div`animation: 2s ${keyframes`${fadeInLeft}`} infinite`; 103 | const FadeInLeftBig = styled.div`animation: 2s ${keyframes`${fadeInLeftBig}`} infinite`; 104 | const FadeInRight = styled.div`animation: 2s ${keyframes`${fadeInRight}`} infinite`; 105 | const FadeInRightBig = styled.div`animation: 2s ${keyframes`${fadeInRightBig}`} infinite`; 106 | const FadeInUp = styled.div`animation: 2s ${keyframes`${fadeInUp}`} infinite`; 107 | const FadeInUpBig = styled.div`animation: 2s ${keyframes`${fadeInUpBig}`} infinite`; 108 | const FadeOut = styled.div`animation: 2s ${keyframes`${fadeOut}`} infinite`; 109 | const FadeOutDown = styled.div`animation: 2s ${keyframes`${fadeOutDown}`} infinite`; 110 | const FadeOutDownBig = styled.div`animation: 2s ${keyframes`${fadeOutDownBig}`} infinite`; 111 | const FadeOutLeft = styled.div`animation: 2s ${keyframes`${fadeOutLeft}`} infinite`; 112 | const FadeOutLeftBig = styled.div`animation: 2s ${keyframes`${fadeOutLeftBig}`} infinite`; 113 | const FadeOutRight = styled.div`animation: 2s ${keyframes`${fadeOutRight}`} infinite`; 114 | const FadeOutRightBig = styled.div`animation: 2s ${keyframes`${fadeOutRightBig}`} infinite`; 115 | const FadeOutUp = styled.div`animation: 2s ${keyframes`${fadeOutUp}`} infinite`; 116 | const FadeOutUpBig = styled.div`animation: 2s ${keyframes`${fadeOutUpBig}`} infinite`; 117 | const Flash = styled.div`animation: 2s ${keyframes`${flash}`} infinite`; 118 | const Flip = styled.div`animation: 2s ${keyframes`${flip}`} infinite`; 119 | const FlipInX = styled.div`animation: 2s ${keyframes`${flipInX}`} infinite`; 120 | const FlipInY = styled.div`animation: 2s ${keyframes`${flipInY}`} infinite`; 121 | const FlipOutX = styled.div`animation: 2s ${keyframes`${flipOutX}`} infinite`; 122 | const FlipOutY = styled.div`animation: 2s ${keyframes`${flipOutY}`} infinite`; 123 | const HeadShake = styled.div`animation: 2s ${keyframes`${headShake}`} infinite`; 124 | const Hinge = styled.div`animation: 2s ${keyframes`${hinge}`} infinite`; 125 | const Jello = styled.div`animation: 2s ${keyframes`${jello}`} infinite`; 126 | const LightSpeedIn = styled.div`animation: 2s ${keyframes`${lightSpeedIn}`} infinite`; 127 | const LightSpeedOut = styled.div`animation: 2s ${keyframes`${lightSpeedOut}`} infinite`; 128 | const Pulse = styled.div`animation: 2s ${keyframes`${pulse}`} infinite`; 129 | const RollIn = styled.div`animation: 2s ${keyframes`${rollIn}`} infinite`; 130 | const RollOut = styled.div`animation: 2s ${keyframes`${rollOut}`} infinite`; 131 | const RotateIn = styled.div`animation: 2s ${keyframes`${rotateIn}`} infinite`; 132 | const RotateInDownLeft = styled.div`animation: 2s ${keyframes`${rotateInDownLeft}`} infinite`; 133 | const RotateInDownRight = styled.div`animation: 2s ${keyframes`${rotateInDownRight}`} infinite`; 134 | const RotateInUpLeft = styled.div`animation: 2s ${keyframes`${rotateInUpLeft}`} infinite`; 135 | const RotateInUpRight = styled.div`animation: 2s ${keyframes`${rotateInUpRight}`} infinite`; 136 | const RotateOut = styled.div`animation: 2s ${keyframes`${rotateOut}`} infinite`; 137 | const RotateOutDownLeft = styled.div`animation: 2s ${keyframes`${rotateOutDownLeft}`} infinite`; 138 | const RotateOutDownRight = styled.div`animation: 2s ${keyframes`${rotateOutDownRight}`} infinite`; 139 | const RotateOutUpLeft = styled.div`animation: 2s ${keyframes`${rotateOutUpLeft}`} infinite`; 140 | const RotateOutUpRight = styled.div`animation: 2s ${keyframes`${rotateOutUpRight}`} infinite`; 141 | const RubberBand = styled.div`animation: 2s ${keyframes`${rubberBand}`} infinite`; 142 | const Shake = styled.div`animation: 2s ${keyframes`${shake}`} infinite`; 143 | const SlideInDown = styled.div`animation: 2s ${keyframes`${slideInDown}`} infinite`; 144 | const SlideInLeft = styled.div`animation: 2s ${keyframes`${slideInLeft}`} infinite`; 145 | const SlideInRight = styled.div`animation: 2s ${keyframes`${slideInRight}`} infinite`; 146 | const SlideInUp = styled.div`animation: 2s ${keyframes`${slideInUp}`} infinite`; 147 | const SlideOutDown = styled.div`animation: 2s ${keyframes`${slideOutDown}`} infinite`; 148 | const SlideOutLeft = styled.div`animation: 2s ${keyframes`${slideOutLeft}`} infinite`; 149 | const SlideOutRight = styled.div`animation: 2s ${keyframes`${slideOutRight}`} infinite`; 150 | const SlideOutUp = styled.div`animation: 2s ${keyframes`${slideOutUp}`} infinite`; 151 | const Swing = styled.div`animation: 2s ${keyframes`${swing}`} infinite`; 152 | const Tada = styled.div`animation: 2s ${keyframes`${tada}`} infinite`; 153 | const Wobble = styled.div`animation: 2s ${keyframes`${wobble}`} infinite`; 154 | const ZoomIn = styled.div`animation: 2s ${keyframes`${zoomIn}`} infinite`; 155 | const ZoomInDown = styled.div`animation: 2s ${keyframes`${zoomInDown}`} infinite`; 156 | const ZoomInLeft = styled.div`animation: 2s ${keyframes`${zoomInLeft}`} infinite`; 157 | const ZoomInRight = styled.div`animation: 2s ${keyframes`${zoomInRight}`} infinite`; 158 | const ZoomInUp = styled.div`animation: 2s ${keyframes`${zoomInUp}`} infinite`; 159 | const ZoomOut = styled.div`animation: 2s ${keyframes`${zoomOut}`} infinite`; 160 | const ZoomOutDown = styled.div`animation: 2s ${keyframes`${zoomOutDown}`} infinite`; 161 | const ZoomOutLeft = styled.div`animation: 2s ${keyframes`${zoomOutLeft}`} infinite`; 162 | const ZoomOutRight = styled.div`animation: 2s ${keyframes`${zoomOutRight}`} infinite`; 163 | const ZoomOutUp = styled.div`animation: 2s ${keyframes`${zoomOutUp}`} infinite`; 164 | 165 | 166 | class ReactAnimations extends Component { 167 | 168 | render() { 169 | return ( 170 | 171 |
172 |

Hello Animation Bounce

173 | {/*/!**!/*/} 174 | {/*/!**!/*/} 175 | {/*/!**!/*/} 176 | {/*/!**!/*/} 177 | {/*/!**!/*/} 178 | {/*/!**!/*/} 179 | {/*/!**!/*/} 180 | {/*/!**!/*/} 181 | {/*/!**!/*/} 182 | {/**/} 183 | {/**/} 184 | {/*/!**!/*/} 185 | {/*/!**!/*/} 186 | {/*/!**!/*/} 187 | {/*/!**!/*/} 188 | {/*/!**!/*/} 189 | {/*/!**!/*/} 190 | {/*/!**!/*/} 191 | {/*/!**!/*/} 192 | {/*/!**!/*/} 193 | {/*/!**!/*/} 194 | {/*/!**!/*/} 195 | {/*/!**!/*/} 196 | {/*/!**!/*/} 197 | {/*/!**!/*/} 198 | {/*/!**!/*/} 199 | {/*/!**!/*/} 200 | {/**/} 201 | {/*/!**!/*/} 202 | {/**/} 203 | {/*/!**!/*/} 204 | {/*/!**!/*/} 205 | {/*/!**!/*/} 206 | {/**/} 207 | {/**/} 208 | {/**/} 209 | {/*/!**!/*/} 210 | {/*/!**!/*/} 211 | {/**/} 212 | {/**/} 213 | {/*/!**!/*/} 214 | {/*/!**!/*/} 215 | {/**/} 216 | {/**/} 217 | {/*/!**!/*/} 218 | {/*/!**!/*/} 219 | {/*/!**!/*/} 220 | {/*/!**!/*/} 221 | {/*/!**!/*/} 222 | {/**/} 223 | {/**/} 224 | {/**/} 225 | {/*/!**!/*/} 226 | {/*/!**!/*/} 227 | {/*/!**!/*/} 228 | {/*/!**!/*/} 229 | {/*/!**!/*/} 230 | {/*/!**!/*/} 231 | {/*/!**!/*/} 232 | {/**/} 233 | {/**/} 234 | {/**/} 235 | {/**/} 236 | {/*/!**!/*/} 237 | {/*/!**!/*/} 238 | {/*/!**!/*/} 239 | {/*/!**!/*/} 240 | {/**/} 241 | {/*/!**!/*/} 242 | {/*/!**!/*/} 243 | {/*/!**!/*/} 244 | {/*/!**!/*/} 245 |
246 |
247 | ); 248 | } 249 | 250 | 251 | 252 | } 253 | 254 | export default ReactAnimations; 255 | -------------------------------------------------------------------------------- /src/pages/ReactAnimations/item.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export const Item = ({ name }) =>
{name}
; 4 | 5 | export default Item; 6 | -------------------------------------------------------------------------------- /src/pages/ReactAnimations/style.css: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | display: flex; 3 | align-items: center; 4 | flex-flow: wrap; 5 | margin: 25px; 6 | } 7 | 8 | .react-animate-item { 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | width: 100px; 13 | height: 100px; 14 | margin: 25px; 15 | background: #fff; 16 | border-radius: 5px; 17 | font-size: 10px; 18 | box-shadow: 0 0 8px 1px rgba(0,0,0, .1); 19 | } 20 | 21 | h1 { 22 | margin: 25px!important; 23 | } 24 | -------------------------------------------------------------------------------- /src/pages/ReactAnimations/test.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import styled, { keyframes } from 'styled-components'; 3 | import { bounce } from 'react-animations'; 4 | import './style.css'; 5 | 6 | const Bounce = styled.div`animation: 2s ${keyframes`${bounce}`} infinite`; 7 | 8 | export default class ReactAnimations extends Component { 9 | render() { 10 | return ( 11 |

Hello Animation Bounce

12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/pages/ReactMotion/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import {Motion, spring} from 'react-motion'; 3 | // In your render... 4 | 5 | export default class ReactMotion extends Component { 6 | 7 | state = { 8 | top: 0, 9 | opacity: .5, 10 | }; 11 | animate = () => { 12 | const { top, opacity } = this.state; 13 | let newTop = top; 14 | let newOpacity = opacity; 15 | newTop = top === 0 ? 30 : 0; 16 | console.log('newTop', newTop); 17 | newOpacity = opacity === 1 ? .5 : 1; 18 | this.setState({ top: newTop, opacity: newOpacity }); 19 | }; 20 | componentDidMount() { 21 | this.animate(); 22 | } 23 | render() { 24 | const { top, opacity } = this.state; 25 | return ( 26 |
27 |
Animate
28 | 33 | { 34 | ({ height, opacity }) =>
35 |

Hello

38 |
39 | } 40 |
41 |
42 | ); 43 | } 44 | } 45 | 46 | 47 | 48 | const styles = { 49 | app: { 50 | width: '100%', 51 | height: 500, 52 | backgroundImage: 'url(https://images.pexels.com/photos/113338/pexels-photo-113338.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)', 53 | backgroundSize: 'cover', 54 | }, 55 | title: { 56 | textAlign: 'center', 57 | transition: '.3s', 58 | }, 59 | selection: { 60 | padding: 10, 61 | margin: 0, 62 | borderBottom: '1px solid #ededed' 63 | }, 64 | button: { 65 | justifyContent: 'center', 66 | alignItems: 'center', 67 | display: 'flex', 68 | cursor: 'pointer', 69 | width: 200, 70 | height: 45, 71 | border: 'none', 72 | borderRadius: 4, 73 | backgroundColor: '#ffc107', 74 | }, 75 | } 76 | -------------------------------------------------------------------------------- /src/pages/ReactReveal/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import Fade from 'react-reveal/Fade'; 3 | 4 | export default class ReactReveal extends Component { 5 | 6 | render() { 7 | const animateList = [1,2,3,4,5]; 8 | return ( 9 | 10 | {animateList.map((item, key) => ( 11 |
12 | 13 |

{`block ${item}`}

14 |
15 |
16 | ))} 17 |
18 | ); 19 | } 20 | } 21 | 22 | const styles = { 23 | block: { 24 | display: 'flex', 25 | alignItems: 'center', 26 | justifyContent: 'center', 27 | width: '100%', 28 | height: '100%', 29 | background: '#000', 30 | borderBottom: '1px solid rgba(255,255,255,.2)' 31 | }, 32 | title: { 33 | textAlign: 'center', 34 | fontSize: 100, 35 | color: '#fff', 36 | fontFamily: 'Lato, sans-serif', 37 | fontWeight: 100 38 | }, 39 | }; 40 | -------------------------------------------------------------------------------- /src/pages/ReactTransitionGroup/button.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from 'antd' 3 | 4 | export const Btn = ({ onClick }) => ( 5 | 12 | ); 13 | 14 | 15 | export default Btn; 16 | -------------------------------------------------------------------------------- /src/pages/ReactTransitionGroup/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import { CSSTransitionGroup } from 'react-transition-group'; 3 | import random from 'random-name' 4 | import Button from './button' 5 | import Item from './item' 6 | import './style.css'; 7 | 8 | export default class ReactTransitionGroup extends Component { 9 | 10 | constructor(props) { 11 | super(props); 12 | this.state = { items: ['Natividad Steen'] }; 13 | this.handleAdd = this.handleAdd.bind(this); 14 | } 15 | 16 | handleAdd() { 17 | let newItems = this.state.items; 18 | newItems.push(random()); 19 | this.setState({ items: newItems }); 20 | } 21 | 22 | handleRemove(i) { 23 | let newItems = this.state.items.slice(); 24 | newItems.splice(i, 1); 25 | this.setState({items: newItems}); 26 | } 27 | 28 | render() { 29 | const items = this.state.items.map((item, i) => ( 30 | this.handleRemove(i)} /> 31 | )); 32 | 33 | return ( 34 |
35 |
44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/pages/ReactTransitionGroup/item.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { List, Icon } from 'antd' 3 | 4 | export const ContactsList = ({ item, keyDelete, handleRemove }) => ( 5 | 6 | {item} 7 | handleRemove(keyDelete)} /> 8 | 9 | ); 10 | 11 | export default ContactsList; 12 | -------------------------------------------------------------------------------- /src/pages/ReactTransitionGroup/style.css: -------------------------------------------------------------------------------- 1 | .react-transition-group { 2 | display: flex; 3 | height: 100%; 4 | width: 100%; 5 | padding: 50px; 6 | flex-direction: column; 7 | align-items: center; 8 | margin: 0 auto; 9 | } 10 | 11 | .project { 12 | width: 380px; 13 | margin-top: 20px; 14 | } 15 | 16 | 17 | .example-enter { 18 | opacity: 0.01; 19 | } 20 | 21 | .example-enter.example-enter-active { 22 | opacity: 1; 23 | transition: opacity 300ms ease-in; 24 | } 25 | 26 | .example-leave { 27 | opacity: 1; 28 | } 29 | 30 | .example-leave.example-leave-active { 31 | opacity: 0.01; 32 | transition: opacity 300ms ease-in; 33 | } 34 | 35 | .item { 36 | display: flex; 37 | width: 100%; 38 | align-items: center; 39 | justify-content: space-between; 40 | padding: 25px; 41 | margin-bottom: 10px; 42 | height: 30px; 43 | background: #fff; 44 | border-radius: 5px; 45 | border-bottom: 1px solid #fff; 46 | color: #444; 47 | box-sizing: border-box; 48 | } 49 | 50 | 51 | 52 | @media screen and (max-width: 768px) { 53 | .project { 54 | width: 300px; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read http://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit http://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | --------------------------------------------------------------------------------