Skip to content

Commit aab07b7

Browse files
Lucas Bentokelset
authored andcommitted
upgrade emotion and antd
1 parent 9b713d6 commit aab07b7

15 files changed

+653
-810
lines changed

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
},
1616
"dependencies": {
1717
"@ant-design/icons": "4.0.3",
18-
"@emotion/core": "10.0.28",
19-
"@emotion/styled": "10.0.27",
20-
"antd": "4.0.3",
18+
"@emotion/react": "^11.10.6",
19+
"@emotion/styled": "^11.10.6",
20+
"antd": "5.2.3",
2121
"date-fns": "^2.29.3",
2222
"framer-motion": "^2.9.5",
2323
"markdown-to-jsx": "7.1.9",
@@ -35,7 +35,8 @@
3535
"use-persisted-state": "^0.3.3"
3636
},
3737
"devDependencies": {
38-
"@emotion/babel-preset-css-prop": "10.0.27",
38+
"@emotion/babel-preset-css-prop": "^11.10.0",
39+
"@emotion/eslint-plugin": "^11.10.0",
3940
"@testing-library/react": "^14.0.0",
4041
"customize-cra": "^1.0.0",
4142
"eslint": "^8.35.0",
@@ -65,7 +66,8 @@
6566
"react-app"
6667
],
6768
"plugins": [
68-
"prettier"
69+
"prettier",
70+
"@emotion"
6971
],
7072
"rules": {
7173
"prettier/prettier": "error",

src/components/common/BinaryDownload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const BinaryList = ({ binaryFiles, toVersion, appName, packageName }) =>
3939
{removeAppPathPrefix(newPath, appName)}
4040

4141
<DownloadFileButton
42-
visible={true}
42+
open={true}
4343
version={toVersion}
4444
path={newPath}
4545
packageName={packageName}

src/components/common/CompletedFilesCounter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import styled from '@emotion/styled'
3-
import { keyframes, css } from '@emotion/core'
3+
import { keyframes, css } from '@emotion/react'
44
import Confetti from 'react-dom-confetti'
55
import { Popover } from 'antd'
66

src/components/common/Diff/DiffComment.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ const lineColors = {
1010
neutral: '#ffffff',
1111
}
1212

13-
const Container = styled(({ isCommentVisible, children, ...props }) => (
13+
const Container = styled(({ isCommentOpen, children, ...props }) => (
1414
<motion.div
1515
{...props}
1616
variants={{
17-
visible: {
17+
open: {
1818
height: 'auto',
1919
},
2020
hidden: { height: 10 },
2121
}}
22-
initial={isCommentVisible ? 'visible' : 'hidden'}
23-
animate={isCommentVisible ? 'visible' : 'hidden'}
22+
initial={isCommentOpen ? 'open' : 'hidden'}
23+
animate={isCommentOpen ? 'open' : 'hidden'}
2424
transition={{
2525
duration: 0.5,
2626
}}
@@ -48,20 +48,20 @@ const ContentContainer = styled.div`
4848
user-select: none;
4949
`
5050

51-
const ShowButton = styled(({ isCommentVisible, ...props }) => (
51+
const ShowButton = styled(({ isCommentOpen, ...props }) => (
5252
<motion.div
5353
{...props}
5454
variants={{
55-
visible: {
55+
open: {
5656
scaleX: 1,
5757
},
5858
hidden: { scaleX: 10 },
5959
}}
6060
whileHover={{
6161
scale: 2,
6262
}}
63-
initial={isCommentVisible ? 'visible' : 'hidden'}
64-
animate={isCommentVisible ? 'visible' : 'hidden'}
63+
initial={isCommentOpen ? 'open' : 'hidden'}
64+
animate={isCommentOpen ? 'open' : 'hidden'}
6565
transition={{
6666
duration: 0.25,
6767
}}
@@ -75,8 +75,8 @@ const ShowButton = styled(({ isCommentVisible, ...props }) => (
7575

7676
const Content = styled(Markdown)`
7777
opacity: 1;
78-
${({ isCommentVisible }) =>
79-
!isCommentVisible &&
78+
${({ isCommentOpen }) =>
79+
!isCommentOpen &&
8080
`
8181
opacity: 0;
8282
`}
@@ -131,21 +131,21 @@ const getComments = ({ packageName, newPath, fromVersion, toVersion }) => {
131131
}
132132

133133
const DiffComment = ({ content, lineChangeType }) => {
134-
const [isCommentVisible, setIsCommentVisible] = useState(true)
134+
const [isCommentOpen, setIsCommentOpen] = useState(true)
135135

136136
return (
137137
<Container
138-
isCommentVisible={isCommentVisible}
138+
isCommentOpen={isCommentOpen}
139139
lineChangeType={lineChangeType}
140-
onClick={() => setIsCommentVisible(!isCommentVisible)}
140+
onClick={() => setIsCommentOpen(!isCommentOpen)}
141141
>
142142
<ShowButton
143-
isCommentVisible={isCommentVisible}
144-
onClick={() => setIsCommentVisible(!isCommentVisible)}
143+
isCommentOpen={isCommentOpen}
144+
onClick={() => setIsCommentOpen(!isCommentOpen)}
145145
/>
146146

147147
<ContentContainer>
148-
<Content isCommentVisible={isCommentVisible}>
148+
<Content isCommentOpen={isCommentOpen}>
149149
{content.props.children}
150150
</Content>
151151
</ContentContainer>

src/components/common/Diff/DiffCommentReminder.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { getTransitionDuration } from '../../../utils'
77
const DiffCommentReminder = styled(
88
({ comments, isDiffCollapsed, uncollapseDiff, ...props }) => {
99
const numberOfComments = Object.keys(comments).length
10-
const isVisible = isDiffCollapsed && numberOfComments > 0
10+
const isOpen = isDiffCollapsed && numberOfComments > 0
1111

1212
return (
1313
<motion.div
1414
{...props}
1515
variants={{
16-
visible: { opacity: 1, cursor: 'pointer' },
17-
invisible: { opacity: 0, cursor: 'initial' },
16+
open: { opacity: 1, cursor: 'pointer' },
17+
closed: { opacity: 0, cursor: 'initial' },
1818
}}
19-
animate={isVisible > 0 ? 'visible' : 'invisible'}
19+
animate={isOpen > 0 ? 'open' : 'closed'}
2020
transition={{
2121
duration: getTransitionDuration(0.5),
2222
}}

src/components/common/Diff/DiffHeader.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ const FileStatus = ({ type, ...props }) => {
7979
)
8080
}
8181

82-
const BinaryBadge = ({ visible, ...props }) =>
83-
visible ? (
82+
const BinaryBadge = ({ open, ...props }) =>
83+
open ? (
8484
<Tag {...props} color="cyan">
8585
BINARY
8686
</Tag>
@@ -96,8 +96,8 @@ const defaultIconButtonStyle = `
9696
border-radius: 50%;
9797
`
9898

99-
const CompleteDiffButton = styled(({ visible, onClick, ...props }) =>
100-
visible ? (
99+
const CompleteDiffButton = styled(({ open, onClick, ...props }) =>
100+
open ? (
101101
<Button
102102
{...props}
103103
type="ghost"
@@ -161,8 +161,8 @@ const CollapseClickableArea = styled.div`
161161
}
162162
`
163163

164-
const CollapseDiffButton = styled(({ visible, isDiffCollapsed, ...props }) =>
165-
visible ? <Button {...props} type="link" icon={<DownOutlined />} /> : null
164+
const CollapseDiffButton = styled(({ open, isDiffCollapsed, ...props }) =>
165+
open ? <Button {...props} type="link" icon={<DownOutlined />} /> : null
166166
)`
167167
color: #24292e;
168168
margin-right: 2px;
@@ -208,7 +208,7 @@ const DiffHeader = ({
208208
onClick={({ altKey }) => setIsDiffCollapsed(!isDiffCollapsed, altKey)}
209209
>
210210
<CollapseDiffButton
211-
visible={hasDiff}
211+
open={hasDiff}
212212
isDiffCollapsed={isDiffCollapsed}
213213
/>
214214
<FileName
@@ -218,7 +218,7 @@ const DiffHeader = ({
218218
appName={appName}
219219
/>{' '}
220220
<FileStatus type={type} />
221-
<BinaryBadge visible={!hasDiff} />
221+
<BinaryBadge open={!hasDiff} />
222222
</CollapseClickableArea>
223223
<CopyPathToClipboardButton
224224
oldPath={sanitizedFilePaths.oldPath}
@@ -238,19 +238,19 @@ const DiffHeader = ({
238238
<div>
239239
<Fragment>
240240
<ViewFileButton
241-
visible={hasDiff && type !== 'delete'}
241+
open={hasDiff && type !== 'delete'}
242242
version={toVersion}
243243
path={newPath}
244244
packageName={packageName}
245245
/>
246246
<DownloadFileButton
247-
visible={!hasDiff && type !== 'delete'}
247+
open={!hasDiff && type !== 'delete'}
248248
version={toVersion}
249249
path={newPath}
250250
packageName={packageName}
251251
/>
252252
<CompleteDiffButton
253-
visible={isDiffCompleted}
253+
open={isDiffCompleted}
254254
onClick={() => onCompleteDiff(diffKey)}
255255
/>
256256
</Fragment>

src/components/common/DownloadFileButton.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { DownloadOutlined } from '@ant-design/icons'
55
import { getBinaryFileURL } from '../../utils'
66

77
const DownloadFileButton = styled(
8-
({ visible, version, path, packageName, ...props }) => {
9-
console.info(visible, version, path, packageName)
10-
return visible ? (
8+
({ open, version, path, packageName, ...props }) => {
9+
return open ? (
1110
<Button
1211
{...props}
1312
type="ghost"

src/components/common/Settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ const Settings = ({
124124
</>
125125
}
126126
trigger="click"
127-
visible={popoverVisibility}
128-
onVisibleChange={handleClickChange}
127+
open={popoverVisibility}
128+
onOpenChange={handleClickChange}
129129
>
130130
<SettingsButton icon={<SettingsIcon />} />
131131
</Popover>

src/components/common/TroubleshootingGuides.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const ListContainer = styled.ul`
3131
list-style: disc;
3232
`
3333

34-
const TroubleshootingGuides = ({ isTooltipVisible }) => {
35-
const willHaveAnimation = useRef(isTooltipVisible)
34+
const TroubleshootingGuides = ({ isTooltipOpen }) => {
35+
const willHaveAnimation = useRef(isTooltipOpen)
3636

3737
const containerAnimation = useAnimation()
3838

src/components/common/TroubleshootingGuidesButton.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ const TroubleshootingGuidesButton = () => {
4242
return (
4343
<Popover
4444
placement="bottomRight"
45-
content={<TroubleshootingGuides isTooltipVisible={showContent} />}
45+
content={<TroubleshootingGuides isTooltipOpen={showContent} />}
4646
trigger="click"
47-
visible={showContent}
48-
onVisibleChange={handlePopoverVisibilityChange}
47+
open={showContent}
48+
onOpenChange={handlePopoverVisibilityChange}
4949
>
5050
<Button
5151
data-testid={testIDs.troubleshootingGuidesButton}

0 commit comments

Comments
 (0)