RightSidebar.js (1970B)
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 "use strict"; 5 6 // React 7 const { 8 createFactory, 9 } = require("resource://devtools/client/shared/vendor/react.mjs"); 10 const { 11 div, 12 } = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 13 14 const { 15 L10N, 16 } = require("resource://devtools/client/accessibility/utils/l10n.js"); 17 const Accessible = createFactory( 18 require("resource://devtools/client/accessibility/components/Accessible.js") 19 ); 20 const Accordion = createFactory( 21 require("resource://devtools/client/shared/components/Accordion.js") 22 ); 23 const Checks = createFactory( 24 require("resource://devtools/client/accessibility/components/Checks.js") 25 ); 26 27 // Component that is responsible for rendering accessible panel's sidebar. 28 function RightSidebar({ highlightAccessible, unhighlightAccessible, toolbox }) { 29 const propertiesID = "accessibility-properties"; 30 const checksID = "accessibility-checks"; 31 32 return div( 33 { 34 className: "right-sidebar", 35 role: "presentation", 36 tabIndex: "-1", 37 }, 38 Accordion({ 39 items: [ 40 { 41 className: "checks", 42 component: Checks, 43 componentProps: { labelledby: `${checksID}-header` }, 44 header: L10N.getStr("accessibility.checks"), 45 id: checksID, 46 opened: true, 47 }, 48 { 49 className: "accessible", 50 component: Accessible, 51 componentProps: { 52 highlightAccessible, 53 unhighlightAccessible, 54 toolboxHighlighter: toolbox.getHighlighter(), 55 toolbox, 56 labelledby: `${propertiesID}-header`, 57 }, 58 header: L10N.getStr("accessibility.properties"), 59 id: propertiesID, 60 opened: true, 61 }, 62 ], 63 }) 64 ); 65 } 66 67 module.exports = RightSidebar;