Skip to content

Commit

Permalink
chore: remove react-hot-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao Liang committed Jan 31, 2019
1 parent aa7be7e commit 0b3662c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 101 deletions.
1 change: 0 additions & 1 deletion .babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const isTest = process.env.TYPE === 'test';
const plugins = [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
isDevelopment ? 'react-hot-loader/babel' : '',
isTest ? 'istanbul' : '',
].filter(Boolean);

Expand Down
2 changes: 0 additions & 2 deletions config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ module.exports = merge(commonConfig, {
entry: [
'@babel/polyfill',
resolve(__dirname, './polyfill'),
// activate HMR for React (needs to be before everything except polyfills)
'react-hot-loader/patch',
// bundle the client for webpack-dev-server and connect to the provided endpoint
`webpack-dev-server/client?http://${HOST}:${PORT}`,
// bundle the client for hot reloading, only- means to only hot reload for successful updates
Expand Down
11 changes: 7 additions & 4 deletions docs/examples/AccordionExample.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Example from '../components/Example';
import { Accordion, Checkbox, Panel } from '../../src';
import { Accordion, Checkbox } from '../../src';

class AccordionExample extends React.Component {
state = {
Expand Down Expand Up @@ -74,7 +74,8 @@ const exampleProps = {
areas of the list.
</p>
),
exampleCodeSnippet: `<Accordion defaultActivePanelIds={['filter-by-region']} onPanelClick={this.onPanelClick} maxExpand={3}>
exampleCodeSnippet: `
<Accordion defaultActivePanelIds={['filter-by-region']} onPanelClick={this.onPanelClick} maxExpand={3}>
<Accordion.Panel id="filter-by-region" title="Filter by region">
<ul className="list-unstyled">
<li>
Expand All @@ -98,7 +99,8 @@ const exampleProps = {
</li>
</ul>
</Accordion.Panel>
</Accordion>`,
</Accordion>
`,
propTypeSectionArray: [
{
propTypes: [
Expand Down Expand Up @@ -134,7 +136,8 @@ const exampleProps = {
type: 'node',
note: (
<span>
Panel(s) to be rendered inside the Accordion. See <a href="#accordion-panel-example">Accordion.Panels</a>
Accept an array of <a href="#panel-example">{`<Panel />`}</a> or{' '}
<a href="#accordion-panel-example">{`<Accordion.Panel />`}</a>
</span>
),
},
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/AccordionPanelExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const exampleProps = {
componentName: 'Accordion.Panel',
designNotes: (
<p>
See <a href="#panel-example">Panel</a>
This component is equivalent to <a href="#panel-example">Panel</a>
</p>
),
exampleCodeSnippet: `<Accordion.Panel
Expand Down
13 changes: 3 additions & 10 deletions docs/run.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import App from './components/Layout';

const renderApp = () => {
ReactDOM.render(
<AppContainer>
<React.StrictMode>
<App />
</React.StrictMode>
</AppContainer>,
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('app')
);
};

renderApp();

if (module.hot) {
module.hot.accept('./components/Layout', renderApp);
}
70 changes: 0 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
"puppeteer": "^1.11.0",
"react-bootstrap": "^0.31.5",
"react-datepicker": "github:Adslot/react-datepicker#6f912842e7dcec6a6e8ff43fd0e3e79af84a8ba6",
"react-hot-loader": "^4.3.12",
"react-redux": "^5.0.6",
"react-select": "^1.2.1",
"react-syntax-highlighter": "^7.0.0",
Expand Down
7 changes: 0 additions & 7 deletions src/components/adslot-ui/Accordion/AccordionPanel/index.jsx

This file was deleted.

10 changes: 5 additions & 5 deletions src/components/adslot-ui/Accordion/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import Card from 'alexandria/Card';
import AccordionPanel from './AccordionPanel';
import Panel from '../Panel';

class AccordionComponent extends React.PureComponent {
class Accordion extends React.PureComponent {
static propTypes = {
dts: PropTypes.string,
onPanelClick: PropTypes.func,
Expand Down Expand Up @@ -63,7 +63,7 @@ class AccordionComponent extends React.PureComponent {
const { id, isCollapsed } = child.props;

// prevent rendering if child is not an instance of Accordion.Panel
if (child.type.displayName !== AccordionPanel.displayName) {
if (child.type !== Panel) {
return null;
}

Expand All @@ -87,6 +87,6 @@ class AccordionComponent extends React.PureComponent {
}
}

AccordionComponent.Panel = AccordionPanel;
Accordion.Panel = Panel;

export default AccordionComponent;
export default Accordion;

0 comments on commit 0b3662c

Please sign in to comment.