Skip to content

Commit f4669e4

Browse files
author
Lucas Bento
authored
feat: move AppNameWarning to DiffViewer (#130)
feat: move AppNameWarning to DiffViewer Co-authored-by: Lucas Bento <[email protected]>
2 parents b6cbd30 + 84cc713 commit f4669e4

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react'
2+
import styled from 'styled-components'
3+
import { Alert } from 'antd'
4+
import Markdown from './Markdown'
5+
6+
const Container = styled.div({
7+
width: '100%',
8+
marginTop: '16px'
9+
})
10+
11+
export const AppNameWarning = () => (
12+
<Container>
13+
<Alert
14+
message={
15+
<Markdown>
16+
Keep in mind that `RnDiffApp` and `rndiffapp` are placeholders. When
17+
upgrading, you should replace them with your actual project's name.
18+
</Markdown>
19+
}
20+
type="info"
21+
closable
22+
/>
23+
</Container>
24+
)

src/components/common/DiffViewer.js

+4
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%;
@@ -117,6 +118,9 @@ const DiffViewer = ({
117118
fromVersion={fromVersion}
118119
toVersion={toVersion}
119120
/>
121+
122+
<AppNameWarning />
123+
120124
<ViewStyleOptions
121125
handleViewStyleChange={handleViewStyleChange}
122126
diffViewStyle={diffViewStyle}

src/components/common/Markdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const InlineCode = styled.em`
1919
padding: 0.2em 0.4em;
2020
`
2121

22-
export default ({ forceBlock, options = {}, ...props }) => (
22+
export default ({ forceBlock = false, options = {}, ...props }) => (
2323
<Markdown
2424
{...props}
2525
options={{

src/components/pages/Home.js

+1-23
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)