React-motion test

Developer
Size
4,241 Kb
Views
16,192

How do I make an react-motion test?

What is a react-motion test? How do you make a react-motion test? This script and codes were developed by Paul Sherman on 10 November 2022, Thursday.

React-motion test Previews

React-motion test - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>react-motion test</title>
</head>
<body> <div id='root'></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script>
<script src='https://unpkg.com/react-motion/build/react-motion.js'></script>
<script src='https://unpkg.com/[email protected]/umd/react-router.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

React-motion test - Script Codes JS Codes

"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _React = React;
var Component = _React.Component;
var _ReactDOM = ReactDOM;
var render = _ReactDOM.render;
var _ReactRouter = ReactRouter;
var BrowserRouter = _ReactRouter.BrowserRouter;
var Match = _ReactRouter.Match;
var Link = _ReactRouter.Link;
var _ReactMotion = ReactMotion;
var TransitionMotion = _ReactMotion.TransitionMotion;
var spring = _ReactMotion.spring;
var styles = { fill: { position: 'relative', top: 0, left: 0 }
};
var MatchWithFade = function MatchWithFade(_ref) { var Component = _ref.component; var rest = _objectWithoutProperties(_ref, ["component"]); var willLeave = function willLeave() { return { zIndex: 1, opacity: spring(0) }; }; return React.createElement(Match, _extends({}, rest, { children: function children(_ref2) { var matched = _ref2.matched; var props = _objectWithoutProperties(_ref2, ["matched"]); return React.createElement( TransitionMotion, { willLeave: willLeave, styles: matched ? [{ key: rest.pattern, style: { opacity: 1 }, data: props }] : [] }, function (interpolatedStyles) { return React.createElement( "div", null, interpolatedStyles.map(function (config) { return React.createElement( "div", { key: config.key, style: _extends({}, styles.fill, config.style) }, React.createElement(Component, config.data) ); }) ); } ); } }));
};
var TwoOne = function TwoOne() { return React.createElement( "div", null, "Two One" );
};
var TwoTwo = function (_Component) { _inherits(TwoTwo, _Component); function TwoTwo() { _classCallCheck(this, TwoTwo); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } TwoTwo.prototype.componentWillUnmount = function componentWillUnmount() { console.log("TwoTwo will unmount"); }; TwoTwo.prototype.componentWillMount = function componentWillMount() { console.log("TwoTwo will mount"); }; TwoTwo.prototype.render = function render() { return React.createElement( "div", null, "Two Two" ); }; return TwoTwo;
}(Component);
var TwoHome = function TwoHome() { return React.createElement( "div", null, "Two Home" );
};
var One = function (_Component2) { _inherits(One, _Component2); function One() { _classCallCheck(this, One); return _possibleConstructorReturn(this, _Component2.apply(this, arguments)); } One.prototype.componentWillUnmount = function componentWillUnmount() { console.log("ONE UNMOUNTING"); }; One.prototype.render = function render() { return React.createElement( "div", { style: { width: 300, border: '1px solid black', backgroundColor: 'orange', minHeight: 200 } }, "One one one one one one one one one one", React.createElement("br", null), "One one one one one one one one one one", React.createElement("br", null) ); }; return One;
}(Component);
var Two = function Two() { var colors = ['red', 'green', 'yellow']; var bgColor = colors[Math.floor(Math.random() * colors.length)]; return React.createElement( "div", { style: { width: 300, border: '1px solid black', backgroundColor: 'yellow', minHeight: 200 } }, React.createElement(Match, { pattern: "/two/one", component: TwoOne }), React.createElement(Match, { pattern: "/two/two", component: TwoTwo }), React.createElement(Match, { pattern: "/two(/)?", exactly: true, component: TwoHome }) );
};
var App = function (_Component3) { _inherits(App, _Component3); function App() { _classCallCheck(this, App); return _possibleConstructorReturn(this, _Component3.apply(this, arguments)); } App.prototype.render = function render() { return React.createElement( BrowserRouter, null, React.createElement( "div", { style: { padding: 12 } }, React.createElement( "div", { style: { marginBottom: 12 } }, React.createElement( Link, { to: "/one" }, "One" ), " || ", React.createElement( Link, { to: "/two" }, "Two" ), "|| ", React.createElement( Link, { to: "/two/one" }, "Two One" ), "|| ", React.createElement( Link, { to: "/two/two" }, "Two Two" ) ), React.createElement( "div", { style: { position: 'relative' } }, React.createElement(MatchWithFade, { pattern: "/one", component: One }), React.createElement(MatchWithFade, { pattern: "/two", component: Two }) ) ) ); }; return App;
}(Component);
render(React.createElement(App, null), document.getElementById('root'));
React-motion test - Script Codes
React-motion test - Script Codes
Home Page Home
Developer Paul Sherman
Username pshrmn
Uploaded November 10, 2022
Rating 3
Size 4,241 Kb
Views 16,192
Do you need developer help for React-motion test?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Paul Sherman (pshrmn) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!