ProgressInspectionPanel.js (1577B)
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 createFactory, 9 PureComponent, 10 } = require("resource://devtools/client/shared/vendor/react.mjs"); 11 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs"); 12 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 13 14 const TickLabels = createFactory( 15 require("resource://devtools/client/inspector/animation/components/TickLabels.js") 16 ); 17 const TickLines = createFactory( 18 require("resource://devtools/client/inspector/animation/components/TickLines.js") 19 ); 20 21 /** 22 * This component is a panel for the progress of animations or keyframes, supports 23 * displaying the ticks, take the areas of indicator and the list. 24 */ 25 class ProgressInspectionPanel extends PureComponent { 26 static get propTypes() { 27 return { 28 indicator: PropTypes.any.isRequired, 29 list: PropTypes.any.isRequired, 30 ticks: PropTypes.arrayOf(PropTypes.object).isRequired, 31 }; 32 } 33 34 render() { 35 const { indicator, list, ticks } = this.props; 36 37 return dom.div( 38 { 39 className: "progress-inspection-panel", 40 }, 41 dom.div({ className: "background" }, TickLines({ ticks })), 42 dom.div({ className: "indicator" }, indicator), 43 dom.div({ className: "header devtools-toolbar" }, TickLabels({ ticks })), 44 list 45 ); 46 } 47 } 48 49 module.exports = ProgressInspectionPanel;