AnimatedPropertyName.js (1085B)
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 class AnimatedPropertyName extends PureComponent { 14 static get propTypes() { 15 return { 16 name: PropTypes.string.isRequired, 17 state: PropTypes.oneOfType([null, PropTypes.object]).isRequired, 18 }; 19 } 20 21 render() { 22 const { name, state } = this.props; 23 24 return dom.div( 25 { 26 className: 27 "animated-property-name" + 28 (state?.runningOnCompositor ? " compositor" : "") + 29 (state?.warning ? " warning" : ""), 30 title: state ? state.warning : "", 31 }, 32 dom.span({}, name) 33 ); 34 } 35 } 36 37 module.exports = AnimatedPropertyName;