Skip to content

Commit f2d403c

Browse files
committed
feat: move AppNameWarning to DiffViewer
1 parent d180469 commit f2d403c

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react'
2+
import styled from 'styled-components'
3+
import { Alert } from 'antd'
4+
5+
const Container = styled.div({
6+
width: '100%'
7+
})
8+
9+
export const AppNameWarning = () => (
10+
<Container>
11+
<Alert
12+
message="Don't forget: `RnDiffApp` is a placeholder. When upgrading, all
13+
instances of `RnDiffApp` should be `YourProjectName`, all `rndiffapp`
14+
should be `yourprojectname` etc."
15+
type="info"
16+
closable
17+
/>
18+
</Container>
19+
)

src/components/common/DiffViewer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import UsefulContentSection from './UsefulContentSection'
1010
import ViewStyleOptions from './Diff/DiffViewStyleOptions'
1111

1212
import CompletedFilesCounter from './CompletedFilesCounter'
13+
import { AppNameWarning } from './AppNameWarning'
1314

1415
const Container = styled.div`
1516
width: 90%;
@@ -116,6 +117,9 @@ const DiffViewer = ({
116117
fromVersion={fromVersion}
117118
toVersion={toVersion}
118119
/>
120+
121+
<AppNameWarning />
122+
119123
<ViewStyleOptions
120124
handleViewStyleChange={handleViewStyleChange}
121125
diffViewStyle={diffViewStyle}

src/components/pages/Home.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from 'react'
22
import styled from 'styled-components'
3-
import { Alert, Card } from 'antd'
3+
import { Card } from 'antd'
44
import GitHubButton from 'react-github-btn'
55
import ReactGA from 'react-ga'
66
import VersionSelector from '../common/VersionSelector'
@@ -28,13 +28,6 @@ const TitleContainer = styled.div`
2828
align-items: center;
2929
`
3030

31-
const Subtitle = styled.div({
32-
display: 'flex',
33-
alignItems: 'center',
34-
justifyContent: 'center',
35-
marginTop: 50
36-
})
37-
3831
const LogoImg = styled.img`
3932
width: 100px;
4033
margin-bottom: 15px;
@@ -59,7 +52,6 @@ const Home = () => {
5952
const [fromVersion, setFromVersion] = useState('')
6053
const [toVersion, setToVersion] = useState('')
6154
const [showDiff, setShowDiff] = useState(false)
62-
const [showAppNameWarning, setAppNameWarning] = useState(false)
6355
const [settings, setSettings] = useState({
6456
[`${SHOW_LATEST_RCS}`]: false
6557
})
@@ -78,7 +70,6 @@ const Home = () => {
7870

7971
setFromVersion(fromVersion)
8072
setToVersion(toVersion)
81-
setAppNameWarning(true)
8273
setShowDiff(true)
8374
}
8475

@@ -121,19 +112,6 @@ const Home = () => {
121112
showDiff={handleShowDiff}
122113
showReleaseCandidates={settings[SHOW_LATEST_RCS]}
123114
/>
124-
125-
{showAppNameWarning ? (
126-
<Subtitle>
127-
<Alert
128-
message="Don't forget: `RnDiffApp` is a placeholder. When upgrading, all
129-
instances of `RnDiffApp` should be `YourProjectName`, all `rndiffapp`
130-
should be `yourprojectname` etc."
131-
type="warning"
132-
closable
133-
onClose={() => setAppNameWarning(false)}
134-
/>
135-
</Subtitle>
136-
) : null}
137115
</Container>
138116

139117
<DiffViewer

0 commit comments

Comments
 (0)