FontWeight.js (1222B)
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 13 const FontPropertyValue = createFactory( 14 require("resource://devtools/client/inspector/fonts/components/FontPropertyValue.js") 15 ); 16 17 const { 18 getStr, 19 } = require("resource://devtools/client/inspector/fonts/utils/l10n.js"); 20 21 class FontWeight extends PureComponent { 22 static get propTypes() { 23 return { 24 disabled: PropTypes.bool.isRequired, 25 onChange: PropTypes.func.isRequired, 26 value: PropTypes.string.isRequired, 27 }; 28 } 29 30 render() { 31 return FontPropertyValue({ 32 disabled: this.props.disabled, 33 label: getStr("fontinspector.fontWeightLabel"), 34 min: 100, 35 max: 900, 36 name: "font-weight", 37 onChange: this.props.onChange, 38 step: 100, 39 unit: null, 40 value: parseFloat(this.props.value), 41 }); 42 } 43 } 44 45 module.exports = FontWeight;