Skip to content

Commit 807ef29

Browse files
authored
Merge branch 'master' into feat/search-option-select
2 parents b920d53 + 8faec57 commit 807ef29

19 files changed

+416
-202
lines changed

src/components/common/BinaryDownload.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ const BinaryRow = styled.div`
1212
display: flex;
1313
justify-content: space-between;
1414
align-items: center;
15-
background-color: ${({ index }) => (index % 2 === 0 ? '#fafbfc' : '#ffffff')};
16-
color: #24292e;
15+
background-color: ${({ index, theme }) =>
16+
index % 2 === 0 ? theme.rowEven : theme.rowOdd};
1717
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier,
1818
monospace;
1919
font-size: 12px;
2020
width: 500px;
2121
max-width: 500px;
2222
padding: 10px 15px;
23-
border-bottom: 1px solid #e1e4e8;
23+
border-bottom: 1px solid ${({ theme }) => theme.border};
2424
`
2525

2626
const Popover = styled(({ className, ...props }) => (
2727
<AntdPopover overlayClassName={className} {...props} />
2828
))`
2929
.ant-popover-inner-content {
3030
padding: 0;
31-
background: red;
3231
}
3332
`
3433

src/components/common/CompletedFilesCounter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ const CompletedFilesCounter = styled(
5656
position: fixed;
5757
bottom: 20px;
5858
right: 20px;
59-
background: #d5eafd;
59+
background: ${({ theme }) => theme.popover.background};
6060
padding: 10px;
61-
border: 1px solid #1890ff;
61+
border: 1px solid ${({ theme }) => theme.popover.border};
6262
border-radius: 20px;
63-
color: #7dadda;
63+
color: ${({ theme }) => theme.popover.text};
6464
transform: ${({ completed }) =>
6565
completed ? 'translateY(0px)' : 'translateY(70px)'};
6666
display: flex;
@@ -76,7 +76,7 @@ const CompletedFilesCounter = styled(
7676
`}
7777
7878
.completedAmount {
79-
color: #1890ff;
79+
color: ${({ theme }) => theme.popover.border};
8080
}
8181
`
8282

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
import { Button as AntdButton, Tooltip } from 'antd'
3+
import styled from '@emotion/styled'
4+
5+
const Button = styled(AntdButton)`
6+
width: 32px;
7+
padding: 0;
8+
`
9+
10+
const DarkModeButton = ({ isDarkMode, ...props }) => {
11+
return (
12+
<Tooltip placement="bottomLeft" title="Toggle Light/Dark Mode">
13+
<Button {...props}>{isDarkMode ? '🌙' : '☀️'}</Button>
14+
</Tooltip>
15+
)
16+
}
17+
18+
export { DarkModeButton }

src/components/common/Diff/Diff.js

Lines changed: 81 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ const copyPathPopoverContentOpts = {
1717
}
1818

1919
const Container = styled.div`
20-
border: 1px solid #e8e8e8;
20+
border: 1px solid ${({ theme }) => theme.border};
2121
border-radius: 3px;
2222
margin-bottom: 16px;
2323
margin-top: 16px;
24+
color: ${({ theme }) => theme.text};
2425
`
2526

2627
const More = styled.div`
27-
background-color: #f1f8ff;
2828
margin-left: 30px;
2929
padding-left: 4px;
30-
color: '#1b1f23b3';
3130
`
3231

3332
const Decoration = styled(DiffDecoration)`
34-
background-color: #dbedff;
33+
background-color: ${({ theme }) => theme.diff.decorationContentBackground};
34+
color: ${({ theme }) => theme.diff.decorationContent};
3535
`
3636

3737
const DiffView = styled(RDiff)`
@@ -44,31 +44,19 @@ const DiffView = styled(RDiff)`
4444
monospace;
4545
}
4646
47-
td.diff-gutter {
48-
color: rgba(27, 31, 35, 0.3);
49-
padding: 0;
50-
text-align: center;
51-
font-size: 12px;
52-
cursor: auto;
53-
}
54-
5547
td.diff-gutter .diff-line-normal {
56-
background-color: #cdffd8;
57-
border-color: #bef5cb;
48+
background-color: ${({ theme }) => theme.gutterInsertBackground};
49+
border-color: ${({ theme }) => theme.greenBorder};
5850
}
5951
6052
td.diff-gutter:hover {
6153
cursor: pointer;
62-
color: rgba(27, 31, 35, 0.6);
54+
color: ${({ theme }) => theme.textHover};
6355
}
6456
6557
td.diff-code {
6658
font-size: 12px;
67-
color: #24292e;
68-
}
69-
70-
td.diff-code-insert .diff-code-edit {
71-
background-color: #acf2bd;
59+
color: ${({ theme }) => theme.text};
7260
}
7361
7462
td.diff-gutter-omit:before {
@@ -79,6 +67,79 @@ const DiffView = styled(RDiff)`
7967
td.diff-widget-content {
8068
padding: 0;
8169
}
70+
71+
// From diff global
72+
.diff {
73+
background-color: ${({ theme }) => theme.diff.backgroundColor};
74+
color: ${({ theme }) => theme.diff.text};
75+
tab-size: 4;
76+
hyphens: none;
77+
}
78+
79+
.diff::selection {
80+
background-color: ${({ theme }) => theme.diff.selectionMackground};
81+
}
82+
83+
.diff-decoration {
84+
line-height: 2;
85+
font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier,
86+
monospace;
87+
background-color: ${({ theme }) => theme.diff.decorationBackground};
88+
}
89+
90+
.diff-decoration-content {
91+
padding-left: 0.5em;
92+
background-color: ${({ theme }) => theme.diff.contentBackground};
93+
color: ${({ theme }) => theme.diff.decorationContent};
94+
}
95+
96+
.diff-gutter {
97+
padding: 0;
98+
text-align: center;
99+
font-size: 12px;
100+
cursor: auto;
101+
}
102+
103+
.diff-gutter-insert {
104+
background-color: ${({ theme }) => theme.diff.gutterInsertBackground};
105+
}
106+
107+
.diff-gutter-delete {
108+
background-color: ${({ theme }) => theme.diff.gutterDeleteBackground};
109+
}
110+
111+
.diff-gutter-selected {
112+
background-color: ${({ theme }) => theme.diff.gutterSelectedBackground};
113+
}
114+
115+
.diff-code-insert {
116+
background-color: ${({ theme }) => theme.diff.codeInsertBackground};
117+
}
118+
119+
.diff-code-edit {
120+
color: inherit;
121+
}
122+
123+
.diff-code-insert .diff-code-edit {
124+
background-color: ${({ theme }) => theme.diff.codeInsertEditBackground};
125+
}
126+
127+
.diff-code-delete {
128+
background-color: ${({ theme }) => theme.diff.codeDeleteBackground};
129+
}
130+
131+
.diff-code-delete .diff-code-edit {
132+
background-color: ${({ theme }) => theme.diff.codeDeleteEditBackground};
133+
}
134+
135+
.diff-code-selected {
136+
background-color: ${({ theme }) => theme.diff.codeSelectedBackground};
137+
}
138+
139+
.diff-decoration-gutter {
140+
background-color: ${({ theme }) => theme.diff.decorationGutterBackground};
141+
color: ${({ theme }) => theme.diff.decorationGutter};
142+
}
82143
`
83144

84145
// Diff will be collapsed by default if the file has been deleted or has more than 5 hunks

src/components/common/Diff/DiffComment.js

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,40 @@ import { motion } from 'framer-motion'
44
import { removeAppPathPrefix, getVersionsContentInDiff } from '../../../utils'
55
import Markdown from '../Markdown'
66

7-
const lineColors = {
8-
add: '#d6fedb',
9-
delete: '#fdeff0',
10-
neutral: '#ffffff',
11-
}
12-
13-
const Container = styled(({ isCommentOpen, children, ...props }) => (
14-
<motion.div
15-
{...props}
16-
variants={{
17-
open: {
18-
height: 'auto',
19-
},
20-
hidden: { height: 10 },
21-
}}
22-
initial={isCommentOpen ? 'open' : 'hidden'}
23-
animate={isCommentOpen ? 'open' : 'hidden'}
24-
transition={{
25-
duration: 0.5,
26-
}}
27-
inherit={false}
28-
>
29-
<div children={children} />
30-
</motion.div>
31-
))`
7+
const Container = styled(({ isCommentOpen, children, ...props }) => {
8+
return (
9+
<motion.div
10+
{...props}
11+
variants={{
12+
open: {
13+
height: 'auto',
14+
},
15+
hidden: { height: 10 },
16+
}}
17+
initial={isCommentOpen ? 'open' : 'hidden'}
18+
animate={isCommentOpen ? 'open' : 'hidden'}
19+
transition={{
20+
duration: 0.5,
21+
}}
22+
inherit={false}
23+
>
24+
<div children={children} />
25+
</motion.div>
26+
)
27+
})`
3228
overflow: hidden;
3329
3430
& > div {
3531
display: flex;
3632
flex-direction: row;
37-
background-color: ${({ lineChangeType }) => lineColors[lineChangeType]};
33+
background-color: ${({ lineChangeType, theme }) => {
34+
const colorMap = {
35+
add: theme.diff.codeInsertBackground,
36+
delete: theme.diff.codeDeleteBackground,
37+
}
38+
39+
return colorMap[lineChangeType] || theme.background
40+
}};
3841
cursor: pointer;
3942
}
4043
`
@@ -43,8 +46,8 @@ const ContentContainer = styled.div`
4346
flex: 1;
4447
position: relative;
4548
padding: 16px;
46-
color: #000;
47-
background-color: #fffbe6;
49+
color: ${({ theme }) => theme.text};
50+
background-color: ${({ theme }) => theme.yellowBackground};}
4851
user-select: none;
4952
`
5053

@@ -67,7 +70,7 @@ const ShowButton = styled(({ isCommentOpen, ...props }) => (
6770
}}
6871
/>
6972
))`
70-
background-color: #ffe58f;
73+
background-color: ${({ theme }) => theme.yellowBorder};
7174
margin-left: 20px;
7275
width: 10px;
7376
cursor: pointer;

src/components/common/Diff/DiffCommentReminder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ const DiffCommentReminder = styled(
3232
}
3333
)`
3434
display: inline;
35-
background-color: #fffbe6;
35+
background-color: ${({ theme }) => theme.yellowBackground};
3636
padding: 5px;
3737
border-radius: 3px;
3838
margin-left: 10px;
39-
border: 1px solid #ffe58f;
39+
border: 1px solid ${({ theme }) => theme.yellowBorder};
4040
4141
& > .icon {
4242
margin-right: 6px;

src/components/common/Diff/DiffHeader.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ const Wrapper = styled.div`
2626
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier,
2727
monospace;
2828
font-size: 12px;
29-
color: #24292e;
29+
color: ${({ theme }) => theme.text};
3030
line-height: 32px;
31-
background-color: #fafbfc;
32-
border-bottom: 1px solid #e1e4e8;
31+
background-color: ${({ theme }) => theme.background};
32+
border-bottom: 1px solid ${({ theme }) => theme.border};
3333
border-top-left-radius: 2px;
3434
border-top-right-radius: 2px;
3535
padding: 5px 10px;
@@ -122,8 +122,8 @@ const CompleteDiffButton = styled(({ open, onClick, ...props }) =>
122122
&,
123123
&:hover,
124124
&:focus {
125-
color: ${({ isDiffCompleted }) =>
126-
isDiffCompleted ? '#52c41a' : '#24292e'};
125+
color: ${({ isDiffCompleted, theme }) =>
126+
isDiffCompleted ? '#52c41a' : theme.text};
127127
}
128128
`
129129

@@ -212,7 +212,7 @@ const CollapseClickableArea = styled.div`
212212
const CollapseDiffButton = styled(({ open, isDiffCollapsed, ...props }) =>
213213
open ? <Button {...props} type="link" icon={<DownOutlined />} /> : null
214214
)`
215-
color: #24292e;
215+
color: ${({ theme }) => theme.text};
216216
margin-right: 2px;
217217
font-size: 10px;
218218
transform: ${({ isDiffCollapsed }) =>
@@ -223,7 +223,7 @@ const CollapseDiffButton = styled(({ open, isDiffCollapsed, ...props }) =>
223223
height: auto;
224224
&:hover,
225225
&:focus {
226-
color: #24292e;
226+
color: ${({ theme }) => theme.text};
227227
}
228228
`
229229

0 commit comments

Comments
 (0)