React CSSTransitionGroup
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 - 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;
}
Developer | Joost Jansen |
Username | DevItWithDavid |
Uploaded | November 19, 2022 |
Rating | 3 |
Size | 5,296 Kb |
Views | 38,456 |
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!
Name | Size |
IPhone | 5,010 Kb |
A Pen by Joost Jansen | 4,394 Kb |
Material ripple effect with pure CSS and JS | 3,408 Kb |
Firebase Logo Animation | 2,830 Kb |
CSGO image overlay using clip path | 2,794 Kb |
Flexbox is AWESOME | 2,524 Kb |
Skyrim Start Game UI | 4,768 Kb |
Overwatch cards, three styles | 4,047 Kb |
Portfolio Joost Jansen 2016 | 5,671 Kb |
Star Wars Battlefront I 2016 Interface | 6,229 Kb |
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!
Name | Username | Size |
CodeCamp Tribute Page | JonathanDeJesus | 6,860 Kb |
Parallax-ish Sliding Content | Jdsteinbach | 2,748 Kb |
Next Word Predictor | Rfalor | 2,776 Kb |
Pericles mi loro... | Judag | 4,125 Kb |
Polo, the flying squirrel | Agbales | 2,445 Kb |
Delete Hover | Chungman93 | 2,557 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Responsive Boxes without Images | Andymcfee | 4,120 Kb |
CSS Flip Animation | Bbodine1 | 2,525 Kb |
Android Play Store With Slick Carousel | -J0hn- | 4,982 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!