AnimationDetailHeader.js (1417B)
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 getFormattedTitle, 15 } = require("resource://devtools/client/inspector/animation/utils/l10n.js"); 16 17 class AnimationDetailHeader extends PureComponent { 18 static get propTypes() { 19 return { 20 animation: PropTypes.object.isRequired, 21 setDetailVisibility: PropTypes.func.isRequired, 22 }; 23 } 24 25 onClick(event) { 26 event.stopPropagation(); 27 const { setDetailVisibility } = this.props; 28 setDetailVisibility(false); 29 } 30 31 render() { 32 const { animation } = this.props; 33 34 return dom.div( 35 { 36 className: "animation-detail-header devtools-toolbar", 37 }, 38 dom.div( 39 { 40 className: "animation-detail-title", 41 }, 42 getFormattedTitle(animation.state) 43 ), 44 dom.button({ 45 className: "animation-detail-close-button devtools-button", 46 onClick: this.onClick.bind(this), 47 }) 48 ); 49 } 50 } 51 52 module.exports = AnimationDetailHeader;