React CSSTransitionGroup

Developer
Size
5,296 Kb
Views
38,456

How do I make an react csstransitiongroup?

What is a react csstransitiongroup? How do you make a react csstransitiongroup? This script and codes were developed by Joost Jansen on 19 November 2022, Saturday.

React CSSTransitionGroup Previews

React CSSTransitionGroup - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React CSSTransitionGroup</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Monoton|Roboto'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="wrapper"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-with-addons.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.js'></script> <script src="js/index.js"></script>
</body>
</html>

React CSSTransitionGroup - Script Codes CSS Codes

html,
body { height: 100%;
}
body { position: relative; background-color: #ddd; -webkit-font-smoothing: antialiased;
}
.App { width: 600px; background-color: #fff; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); box-shadow: 15px 15px 0 #000;
}
.Topbar { padding: 20px; display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-flow: column nowrap; flex-flow: column nowrap; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; position: relative;
}
.Topbar h2 { margin: 0; font-family: 'Monoton', sans-serif; font-size: 64px; font-weight: lighter;
}
.Topbar button { border: 0; outline: 0; height: 50px; padding: 10px 20px; position: absolute; top: 20px; right: 20px; background-color: magenta; color: #fff; font-family: 'Roboto', sans-serif; font-weight: bold; box-shadow: 5px 5px 0 #000; -webkit-transition: background-color 100ms linear, box-shadow 100ms linear; transition: background-color 100ms linear, box-shadow 100ms linear;
}
.Topbar button:hover { background-color: #ff99ff;
}
.Topbar button:active { background-color: #990099;
}
.Items { max-height: 300px; overflow-y: auto; overflow-x: hidden; padding: 0 20px 10px;
}
.Item { margin: 0 0 15px; padding: 20px; background-color: #d2d2d2; font-family: Roboto, sans-serif; -webkit-transition: background-color 200ms linear; transition: background-color 200ms linear; box-shadow: 5px 5px 0 #000;
}
.Item:hover { background-color: #ff4d4d;
}
.item-enter { opacity: 0.01; -webkit-transform: translate(-40px, 0); transform: translate(-40px, 0);
}
.item-enter.item-enter-active { opacity: 1; -webkit-transform: translate(0, 0); transform: translate(0, 0); -webkit-transition: opacity 500ms ease-out, -webkit-transform 500ms ease-out; transition: opacity 500ms ease-out, -webkit-transform 500ms ease-out; transition: opacity 500ms ease-out, transform 500ms ease-out; transition: opacity 500ms ease-out, transform 500ms ease-out, -webkit-transform 500ms ease-out;
}
.item-leave { opacity: 1; -webkit-transform: translate(0, 0); transform: translate(0, 0);
}
.item-leave.item-leave-active { opacity: 0.01; -webkit-transform: translate(40px, 0); transform: translate(40px, 0); -webkit-transition: opacity 500ms ease-out, -webkit-transform 500ms ease-out; transition: opacity 500ms ease-out, -webkit-transform 500ms ease-out; transition: opacity 500ms ease-out, transform 500ms ease-out; transition: opacity 500ms ease-out, transform 500ms ease-out, -webkit-transform 500ms ease-out;
}
.item-appear { opacity: 0.01; -webkit-transform: translate(-40px, 0); transform: translate(-40px, 0);
}
.item-appear.item-appear-active { opacity: 1; -webkit-transform: translate(0, 0); transform: translate(0, 0); -webkit-transition: opacity 500ms ease-out, -webkit-transform 500ms ease-out; transition: opacity 500ms ease-out, -webkit-transform 500ms ease-out; transition: opacity 500ms ease-out, transform 500ms ease-out; transition: opacity 500ms ease-out, transform 500ms ease-out, -webkit-transform 500ms ease-out;
}

React CSSTransitionGroup - Script Codes JS Codes

'use strict';
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; }
var _React = React;
var Component = _React.Component;
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
var App = function (_Component) { _inherits(App, _Component); function App(props) { _classCallCheck(this, App); var _this = _possibleConstructorReturn(this, _Component.call(this, props)); _this.state = { items: ['Hello', 'this is', 'a very cool', 'list of items'], addCounter: 0 }; _this.addItem = _this.addItem.bind(_this); _this.removeItem = _this.removeItem.bind(_this); return _this; } App.prototype.addItem = function addItem() { var newItems = this.state.items.concat([]); var newAddCounter = this.state.addCounter + 1; newItems.push('New Item ' + leftPad(newAddCounter)); this.setState({ items: newItems, addCounter: newAddCounter }); }; App.prototype.removeItem = function removeItem(index) { var newItems = this.state.items.concat([]); newItems.splice(index, 1); this.setState({ items: newItems }); }; App.prototype.render = function render() { return React.createElement( 'div', { className: 'App' }, React.createElement(Topbar, { addItem: this.addItem }), React.createElement(Items, { items: this.state.items, addCounter: this.state.addCounter, removeItem: this.removeItem }) ); }; return App;
}(Component);
var Topbar = function Topbar(_ref) { var addItem = _ref.addItem; return React.createElement( 'div', { className: 'Topbar' }, React.createElement( 'h2', null, 'React Transition Group List' ), React.createElement( 'button', { onClick: addItem }, 'Add Item' ) );
};
var Items = function Items(_ref2) { var items = _ref2.items; var addCounter = _ref2.addCounter; var removeItem = _ref2.removeItem; var renderedItems = items.map(function (item, i) { return React.createElement( 'p', { key: item, className: 'Item', onClick: function onClick() { return removeItem(i); } }, item ); }); return React.createElement( ReactCSSTransitionGroup, { component: 'div', className: 'Items', transitionName: 'item', transitionAppear: true, transitionAppearTimeout: 500, transitionEnterTimeout: 500, transitionLeaveTimeout: 500 }, renderedItems );
};
ReactDOM.render(React.createElement(App, null), document.querySelector('.wrapper'));
function leftPad(n) { var r = String(n); while (r.length < 4) { r = "0" + r; } return r;
}
React CSSTransitionGroup - Script Codes
React CSSTransitionGroup - Script Codes
Home Page Home
Developer Joost Jansen
Username DevItWithDavid
Uploaded November 19, 2022
Rating 3
Size 5,296 Kb
Views 38,456
Do you need developer help for React CSSTransitionGroup?

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!

Joost Jansen (DevItWithDavid) Script Codes
Create amazing video scripts 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!