mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-26 00:17:47 -10:00
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
25 lines
804 B
JavaScript
25 lines
804 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, createFactory, DOM: dom } =
|
|
require("devtools/client/shared/vendor/react");
|
|
const TabMenuEntry = createFactory(require("./tab-menu-entry"));
|
|
|
|
module.exports = createClass({
|
|
displayName: "TabMenu",
|
|
|
|
render() {
|
|
let { tabs, selectedTabId, selectTab } = this.props;
|
|
let tabLinks = tabs.map(({ id, name, icon }) => {
|
|
let selected = id == selectedTabId;
|
|
return TabMenuEntry({ tabId: id, name, icon, selected, selectTab });
|
|
});
|
|
|
|
// "categories" id used for styling purposes
|
|
return dom.div({ id: "categories" }, tabLinks);
|
|
},
|
|
});
|