mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
64dfb85e35
Make about:debugging code less verbose: - use component factories to avoid having to remove calls to createElement - use React.DOM helpers - components only module.export their class (require('my-component.js').MyComponent -> require('my-component.js')) MozReview-Commit-ID: CBWLgcPUkMf --HG-- extra : rebase_source : 8e3184bf82ad1b59d65bf0e94cc2f4662db856bd
32 lines
930 B
JavaScript
32 lines
930 B
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
const { createClass, DOM: dom } =
|
|
require("devtools/client/shared/vendor/react");
|
|
|
|
module.exports = createClass({
|
|
displayName: "TabMenuEntry",
|
|
|
|
render() {
|
|
let { icon, name, selected } = this.props;
|
|
|
|
// Here .category, .category-icon, .category-name classnames are used to
|
|
// apply common styles defined.
|
|
let className = "category" + (selected ? " selected" : "");
|
|
return dom.div({
|
|
"aria-selected": selected,
|
|
className,
|
|
onClick: this.onClick,
|
|
role: "tab" },
|
|
dom.img({ className: "category-icon", src: icon, role: "presentation" }),
|
|
dom.div({ className: "category-name" }, name));
|
|
},
|
|
|
|
onClick() {
|
|
this.props.selectTab(this.props.tabId);
|
|
}
|
|
});
|