RewindButton.js (1097B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 PureComponent, 9 } = require("resource://devtools/client/shared/vendor/react.mjs"); 10 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 11 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs"); 12 13 const { 14 getStr, 15 } = require("resource://devtools/client/inspector/animation/utils/l10n.js"); 16 17 class RewindButton extends PureComponent { 18 static get propTypes() { 19 return { 20 rewindAnimationsCurrentTime: PropTypes.func.isRequired, 21 }; 22 } 23 24 render() { 25 const { rewindAnimationsCurrentTime } = this.props; 26 27 return dom.button({ 28 className: "rewind-button devtools-button", 29 onClick: event => { 30 event.stopPropagation(); 31 rewindAnimationsCurrentTime(); 32 }, 33 title: getStr("timeline.rewindButtonTooltip"), 34 }); 35 } 36 } 37 38 module.exports = RewindButton;