jh-changes
Shin'ya Ueoka 7 years ago
parent 89c52173ce
commit 44459e39c3
  1. 2
      .eslintrc
  2. 9
      src/settings/components/index.jsx
  3. 5
      src/settings/index.jsx
  4. 13
      src/shared/store/provider.jsx
  5. 2
      webpack.config.js

@ -44,6 +44,7 @@
"no-plusplus": "off", "no-plusplus": "off",
"no-ternary": "off", "no-ternary": "off",
"no-undefined": "off", "no-undefined": "off",
"no-unused-vars": ["error", { "varsIgnorePattern": "h" }],
"no-use-before-define": "off", "no-use-before-define": "off",
"no-warning-comments": "off", "no-warning-comments": "off",
"object-curly-newline": ["error", { "consistent": true }], "object-curly-newline": ["error", { "consistent": true }],
@ -65,5 +66,6 @@
"react/jsx-indent": ["error", 2], "react/jsx-indent": ["error", 2],
"react/prop-types": "off", "react/prop-types": "off",
"react/react-in-jsx-scope": "off"
} }
} }

@ -1,10 +1,9 @@
import './site.scss'; import './site.scss';
import React from 'react'; import { h, Component } from 'preact';
import PropTypes from 'prop-types';
import * as settingActions from 'settings/actions/setting'; import * as settingActions from 'settings/actions/setting';
import * as validator from 'shared/validators/setting'; import * as validator from 'shared/validators/setting';
class SettingsComponent extends React.Component { class SettingsComponent extends Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
@ -84,8 +83,4 @@ class SettingsComponent extends React.Component {
} }
} }
SettingsComponent.contextTypes = {
store: PropTypes.any,
};
export default SettingsComponent; export default SettingsComponent;

@ -1,5 +1,4 @@
import React from 'react'; import { h, render } from 'preact';
import ReactDOM from 'react-dom';
import SettingsComponent from './components'; import SettingsComponent from './components';
import reducer from 'settings/reducers/setting'; import reducer from 'settings/reducers/setting';
import Provider from 'shared/store/provider'; import Provider from 'shared/store/provider';
@ -9,7 +8,7 @@ const store = createStore(reducer);
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
let wrapper = document.getElementById('vimvixen-settings'); let wrapper = document.getElementById('vimvixen-settings');
ReactDOM.render( render(
<Provider store={store}> <Provider store={store}>
<SettingsComponent /> <SettingsComponent />
</Provider>, </Provider>,

@ -1,18 +1,15 @@
import React from 'react'; import { h, Component } from 'preact';
import PropTypes from 'prop-types';
class Provider extends React.PureComponent { class Provider extends Component {
getChildContext() { getChildContext() {
return { store: this.props.store }; return { store: this.props.store };
} }
render() { render() {
return React.Children.only(this.props.children); return <div>
{ this.props.children }
</div>;
} }
} }
Provider.childContextTypes = {
store: PropTypes.any,
};
export default Provider; export default Provider;

@ -25,7 +25,7 @@ config = {
exclude: /node_modules/, exclude: /node_modules/,
loader: 'babel-loader', loader: 'babel-loader',
query: { query: {
presets: ['es2015', 'react'] presets: ['es2015', 'preact']
} }
}, },
{ {