Mailspring/internal_packages/plugins/lib/preferences-plugins.jsx
Jackie Luo 6e07dce03c 🎨(preferences): Updates preferences to look prettier
Summary:
Adds new redesigned preferences with horizontal tab bar and refactored code.

Converts Preferences, Plugins, and a few components to ES6.

Test Plan: Tested locally.

Reviewers: evan, bengotow

Reviewed By: bengotow

Subscribers: juan

Differential Revision: https://phab.nylas.com/D2818
2016-04-01 14:01:26 -07:00

49 lines
922 B
JavaScript

import React from 'react';
import TabsStore from './tabs-store';
import Tabs from './tabs';
class PluginsView extends React.Component {
static displayName = 'PluginsView';
constructor() {
super();
this.state = this._getStateFromStores();
}
componentDidMount() {
this._unsubscribers = [];
this._unsubscribers.push(TabsStore.listen(this._onChange));
}
componentWillUnmount() {
this._unsubscribers.forEach(unsubscribe => unsubscribe());
}
static containerStyles = {
minWidth: 500,
maxWidth: 99999,
}
_getStateFromStores() {
return {tabIndex: TabsStore.tabIndex()};
}
_onChange = () => {
this.setState(this._getStateFromStores());
}
render() {
const PluginsTabComponent = Tabs[this.state.tabIndex].component;
return (
<div className="plugins-view">
<PluginsTabComponent />
</div>
);
}
}
export default PluginsView;