@@ -3,13 +3,15 @@ import styled from 'styled-components'
3
3
import { Card } from 'antd'
4
4
import GitHubButton from 'react-github-btn'
5
5
import ReactGA from 'react-ga'
6
+
6
7
import VersionSelector from '../common/VersionSelector'
7
8
import DiffViewer from '../common/DiffViewer'
8
9
import Settings from '../common/Settings'
9
10
import { homepage } from '../../../package.json'
10
11
import logo from '../../assets/logo.svg'
11
12
import { SHOW_LATEST_RCS } from '../../utils'
12
13
14
+
13
15
const Page = styled . div `
14
16
display: flex;
15
17
align-items: center;
@@ -29,9 +31,9 @@ const TitleContainer = styled.div`
29
31
`
30
32
31
33
const Subtitle = styled . div ( {
32
- display : 'flex' ,
33
- alignItems : 'center' ,
34
- marginTop : 50
34
+ display : 'flex' ,
35
+ alignItems : 'center' ,
36
+ marginTop : 50 ,
35
37
} )
36
38
37
39
const LogoImg = styled . img `
@@ -45,94 +47,92 @@ const TitleHeader = styled.h1`
45
47
`
46
48
47
49
const StarButton = styled ( ( { className, ...props } ) => (
48
- < div className = { className } >
49
- < GitHubButton { ...props } />
50
- </ div >
50
+ < div className = { className } >
51
+ < GitHubButton { ...props } />
52
+ </ div >
51
53
) ) `
52
54
margin-top: 10px;
53
55
margin-left: 15px;
54
56
margin-right: auto;
55
57
`
56
58
57
- const Home = ( ) => {
58
- const [ fromVersion , setFromVersion ] = useState ( '' )
59
- const [ toVersion , setToVersion ] = useState ( '' )
60
- const [ showDiff , setShowDiff ] = useState ( false )
61
- const [ settings , setSettings ] = useState ( {
62
- [ `${ SHOW_LATEST_RCS } ` ] : false
63
- } )
64
-
65
- useEffect ( ( ) => {
66
- if ( process . env . NODE_ENV === 'production' ) {
67
- ReactGA . initialize ( 'UA-136307971-1' )
68
- ReactGA . pageview ( '/' )
69
- }
70
- } , [ ] )
71
-
72
- const handleShowDiff = ( { fromVersion, toVersion } ) => {
73
- if ( fromVersion === toVersion ) {
74
- return
75
- }
76
-
77
- setFromVersion ( fromVersion )
78
- setToVersion ( toVersion )
79
- setShowDiff ( true )
80
- }
81
-
82
- const handleSettingsChange = settingsValues => {
83
- const normalizedIncomingSettings = settingsValues . reduce ( ( acc , val ) => {
84
- acc [ val ] = true
85
- return acc
86
- } , { } )
87
-
88
- setSettings ( normalizedIncomingSettings )
89
- }
90
-
91
- return (
92
- < Page >
93
- < Container >
94
- < TitleContainer >
95
- < LogoImg
96
- alt = "React Native upgrade helper logo"
97
- title = "React Native upgrade helper logo"
98
- src = { logo }
99
- />
100
-
101
- < a href = { homepage } >
102
- < TitleHeader > React Native upgrade helper</ TitleHeader >
103
- </ a >
104
-
105
- < StarButton
106
- href = "https://github.com/react-native-community/upgrade-helper"
107
- data-icon = "octicon-star"
108
- data-show-count = "true"
109
- aria-label = "Star react-native-community/upgrade-helper on GitHub"
110
- >
59
+ export const Home = ( ) => {
60
+ const [ fromVersion , setFromVersion ] = useState ( '' )
61
+ const [ toVersion , setToVersion ] = useState ( '' )
62
+ const [ showDiff , setShowDiff ] = useState ( false )
63
+ const [ settings , setSettings ] = useState ( {
64
+ [ `${ SHOW_LATEST_RCS } ` ] : false ,
65
+ } )
66
+
67
+ useEffect ( ( ) => {
68
+ if ( process . env . NODE_ENV === 'production' ) {
69
+ ReactGA . initialize ( 'UA-136307971-1' )
70
+ ReactGA . pageview ( '/' )
71
+ }
72
+ } , [ ] )
73
+
74
+ const handleShowDiff = ( { fromVersion, toVersion } ) => {
75
+ if ( fromVersion === toVersion ) {
76
+ return
77
+ }
78
+
79
+ setFromVersion ( fromVersion )
80
+ setToVersion ( toVersion )
81
+ setShowDiff ( true )
82
+ }
83
+
84
+ const handleSettingsChange = settingsValues => {
85
+ const normalizedIncomingSettings = settingsValues . reduce ( ( acc , val ) => {
86
+ acc [ val ] = true
87
+ return acc
88
+ } , { } )
89
+
90
+ setSettings ( normalizedIncomingSettings )
91
+ }
92
+
93
+ return (
94
+ < Page >
95
+ < Container >
96
+ < TitleContainer >
97
+ < LogoImg
98
+ alt = "React Native upgrade helper logo"
99
+ title = "React Native upgrade helper logo"
100
+ src = { logo }
101
+ />
102
+
103
+ < a href = { homepage } >
104
+ < TitleHeader > React Native upgrade helper</ TitleHeader >
105
+ </ a >
106
+
107
+ < StarButton
108
+ href = "https://github.com/react-native-community/upgrade-helper"
109
+ data-icon = "octicon-star"
110
+ data-show-count = "true"
111
+ aria-label = "Star react-native-community/upgrade-helper on GitHub"
112
+ >
111
113
Star
112
- </ StarButton >
114
+ </ StarButton >
113
115
114
- < Settings handleSettingsChange = { handleSettingsChange } />
115
- </ TitleContainer >
116
+ < Settings handleSettingsChange = { handleSettingsChange } />
117
+ </ TitleContainer >
116
118
117
- < VersionSelector
118
- showDiff = { handleShowDiff }
119
- showReleaseCandidates = { settings [ SHOW_LATEST_RCS ] }
120
- />
119
+ < VersionSelector
120
+ showDiff = { handleShowDiff }
121
+ showReleaseCandidates = { settings [ SHOW_LATEST_RCS ] }
122
+ />
121
123
122
- < Subtitle >
124
+ < Subtitle >
123
125
Don't forget: `RnDiffApp` is a placeholder. When upgrading, all
124
126
instances of `RnDiffApp` should be `YourProjectName`, all `rndiffapp`
125
127
should be `yourprojectname` etc.
126
- </ Subtitle >
127
- </ Container >
128
-
129
- < DiffViewer
130
- showDiff = { showDiff }
131
- fromVersion = { fromVersion }
132
- toVersion = { toVersion }
133
- />
134
- </ Page >
135
- )
128
+ </ Subtitle >
129
+ </ Container >
130
+
131
+ < DiffViewer
132
+ showDiff = { showDiff }
133
+ fromVersion = { fromVersion }
134
+ toVersion = { toVersion }
135
+ />
136
+ </ Page >
137
+ )
136
138
}
137
-
138
- export default Home
0 commit comments