Skip to content

Commit 780b781

Browse files
authored
Merge pull request #112 from Naturalclar/feat/appNameWarning
Add AppName warning visibility state
2 parents 3a978f2 + 9321949 commit 780b781

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/components/pages/Home.js

Lines changed: 15 additions & 5 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 { Card } from 'antd'
3+
import { Alert, Card } from 'antd'
44
import GitHubButton from 'react-github-btn'
55
import ReactGA from 'react-ga'
66
import VersionSelector from '../common/VersionSelector'
@@ -31,6 +31,7 @@ const TitleContainer = styled.div`
3131
const Subtitle = styled.div({
3232
display: 'flex',
3333
alignItems: 'center',
34+
justifyContent: 'center',
3435
marginTop: 50
3536
})
3637

@@ -58,6 +59,7 @@ const Home = () => {
5859
const [fromVersion, setFromVersion] = useState('')
5960
const [toVersion, setToVersion] = useState('')
6061
const [showDiff, setShowDiff] = useState(false)
62+
const [showAppNameWarning, setAppNameWarning] = useState(false)
6163
const [settings, setSettings] = useState({
6264
[`${SHOW_LATEST_RCS}`]: false
6365
})
@@ -76,6 +78,7 @@ const Home = () => {
7678

7779
setFromVersion(fromVersion)
7880
setToVersion(toVersion)
81+
setAppNameWarning(true)
7982
setShowDiff(true)
8083
}
8184

@@ -119,11 +122,18 @@ const Home = () => {
119122
showReleaseCandidates={settings[SHOW_LATEST_RCS]}
120123
/>
121124

122-
<Subtitle>
123-
Don't forget: `RnDiffApp` is a placeholder. When upgrading, all
125+
{showAppNameWarning ? (
126+
<Subtitle>
127+
<Alert
128+
message="Don't forget: `RnDiffApp` is a placeholder. When upgrading, all
124129
instances of `RnDiffApp` should be `YourProjectName`, all `rndiffapp`
125-
should be `yourprojectname` etc.
126-
</Subtitle>
130+
should be `yourprojectname` etc."
131+
type="warning"
132+
closable
133+
onClose={() => setAppNameWarning(false)}
134+
/>
135+
</Subtitle>
136+
) : null}
127137
</Container>
128138

129139
<DiffViewer

0 commit comments

Comments
 (0)