Skip to content

Commit aaea1e0

Browse files
authored
Merge pull request #121 from xsnippet/react-update
[React-update] Upgrade react to 16.8.6
2 parents ff835e7 + e71b1c7 commit aaea1e0

File tree

8 files changed

+113
-617
lines changed

8 files changed

+113
-617
lines changed

package-lock.json

Lines changed: 73 additions & 548 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"joi": "^13.2.0",
3535
"parse-link-header": "^1.0.1",
3636
"prop-types": "^15.6.0",
37-
"react": "^16.0.0",
37+
"react": "^16.8.6",
3838
"react-ace": "^5.9.0",
3939
"react-custom-scrollbars": "^4.2.1",
40-
"react-dom": "^16.0.0",
40+
"react-dom": "^16.8.6",
4141
"react-redux": "^5.0.6",
4242
"react-router-dom": "^4.2.2",
4343
"react-tag-input": "^5.0.2",

src/components/App.jsx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import React from 'react'
1+
import React, { Fragment } from 'react'
2+
import { BrowserRouter as Router, Route } from 'react-router-dom'
23

34
import Header from './Header'
4-
import Main from './Main'
55
import Sidebar from './Sidebar'
6+
import NewSnippet from './NewSnippet'
7+
import RecentSnippets from './RecentSnippets'
8+
import Snippet from './Snippet'
9+
import About from './About'
10+
import SignIn from './SignIn'
11+
612
import Spinner from './common/Spinner'
713
import conf from '../conf'
814

@@ -38,13 +44,23 @@ class App extends React.Component {
3844
return <Spinner />
3945
}
4046

41-
return [
42-
<Header key="header" />,
43-
<div className="content" key="content">
44-
<Sidebar />
45-
<Main />
46-
</div>,
47-
]
47+
return (
48+
<Router>
49+
<Fragment>
50+
<Header key="header" />
51+
<div className="content" key="content">
52+
<Sidebar />
53+
<main className="main">
54+
<Route exact path="/" component={NewSnippet} />
55+
<Route exact path="/recent" component={RecentSnippets} />
56+
<Route exact path="/:id(\d+)" component={Snippet} />
57+
<Route exact path="/about" component={About} />
58+
<Route exact path="/sign-in" component={SignIn} />
59+
</main>
60+
</div>
61+
</Fragment>
62+
</Router>
63+
)
4864
}
4965
}
5066

src/components/Main.jsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/index.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom'
3-
import { BrowserRouter } from 'react-router-dom'
43
import { Provider } from 'react-redux'
54

65
import App from './components/App'
@@ -11,9 +10,7 @@ const store = createStore()
1110
ReactDOM.render(
1211
(
1312
<Provider store={store}>
14-
<BrowserRouter>
15-
<App />
16-
</BrowserRouter>
13+
<App />
1714
</Provider>
1815
), document.getElementById('root'),
1916
)

src/styles/App.styl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@ html, body, body > div
88
.content
99
display: flex
1010
min-height: 100%
11+
12+
.main
13+
padding: 27px 20px;
14+
width: "calc(100% - %s)" % offset
15+
min-width: 480px
16+
min-height: 100%
17+
margin-top: offset
18+
margin-left: offset
19+
overflow-y: auto
20+
background-color: site-bg
21+
font-family: font-quicksand

src/styles/Main.styl

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/components/Snippet.test.jsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react'
2-
import { shallow, mount } from 'enzyme'
2+
import { shallow } from 'enzyme'
33
import { Map } from 'immutable'
44

55
import { Snippet } from '../../src/components/Snippet'
66
import Spinner from '../../src/components/common/Spinner'
7-
import * as misc from '../../src/misc'
87

98
describe('Snippet', () => {
109
const match = { params: { id: 1 } }
@@ -98,20 +97,4 @@ describe('Snippet', () => {
9897

9998
expect(spy).toHaveBeenCalled()
10099
})
101-
102-
it('should trigger copy handler on Copy button click', () => {
103-
misc.copyToClipboard = jest.fn()
104-
105-
const wrapper = mount(<Snippet snippet={snippet} match={match} dispatch={jest.fn()} />)
106-
const instance = wrapper.instance()
107-
const spy = jest.spyOn(instance, 'copyClipboard')
108-
109-
instance.forceUpdate()
110-
111-
const copyButton = wrapper.find('.snippet-embed-content .snippet-button')
112-
113-
copyButton.simulate('click')
114-
115-
expect(spy).toHaveBeenCalled()
116-
})
117100
})

0 commit comments

Comments
 (0)