mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
3407a31cf6
* Improving CLI build * Improving CLI build * Remove requirement to build the tools * Moved Electron app one level down * Clean up Electron build * Moved tools to sub-dir * Updated root script * update root * update root * update root * update root * update root * update root * Updated build * Added doc * Update CI config * Should not lint index.js * Fixing jetify * Fixed linter errors * Fixed pod build * Fixed Windows build
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
const React = require('react');
|
|
const styleSelector = require('./style/ConfigMenuBar');
|
|
const Setting = require('lib/models/Setting');
|
|
|
|
function ConfigMenuBarButton(props) {
|
|
const style = styleSelector(null, props);
|
|
|
|
const iconStyle = props.selected ? style.buttonIconSelected : style.buttonIcon;
|
|
const labelStyle = props.selected ? style.buttonLabelSelected : style.buttonLabel;
|
|
|
|
return (
|
|
<button style={style.button} onClick={props.onClick}>
|
|
<i style={iconStyle} className={`fa ${props.iconName}`}></i>
|
|
<span style={labelStyle}>{props.label}</span>
|
|
</button>
|
|
);
|
|
}
|
|
|
|
function ConfigMenuBar(props) {
|
|
const buttons = [];
|
|
|
|
const style = styleSelector(null, props);
|
|
|
|
for (const section of props.sections) {
|
|
buttons.push(<ConfigMenuBarButton
|
|
selected={props.selection === section.name}
|
|
theme={props.theme}
|
|
key={section.name}
|
|
iconName={Setting.sectionNameToIcon(section.name)}
|
|
label={Setting.sectionNameToLabel(section.name)}
|
|
onClick={() => { props.onSelectionChange({ section: section }); }}
|
|
/>);
|
|
}
|
|
|
|
return (
|
|
<div style={style.root} className="config-menu-bar">
|
|
<div style={style.barButtons}>
|
|
{buttons}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
module.exports = ConfigMenuBar;
|