Skip to content

Commit 05a91f8

Browse files
committed
Fix the content loader.
1 parent 0a749f9 commit 05a91f8

File tree

3 files changed

+49
-45
lines changed

3 files changed

+49
-45
lines changed

src/components/common/Diff/DiffLoading.js

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,55 @@ import styled from '@emotion/styled'
33
import { motion } from 'framer-motion'
44
import ContentLoader from 'react-content-loader'
55
import { getTransitionDuration } from '../../../utils'
6+
import { useTheme } from '@emotion/react'
67

7-
const TitleLoader = () => (
8-
<ContentLoader
9-
speed={1}
10-
backgroundColor="#eee"
11-
foregroundColor="#e6e6e6"
12-
viewBox="0 0 400 100"
13-
>
14-
<rect width="250" height="6" rx="1.5" />
15-
</ContentLoader>
16-
)
8+
const TitleLoader = () => {
9+
const theme = useTheme()
1710

18-
const DiffLoader = () => (
19-
<ContentLoader
20-
speed={1}
21-
backgroundColor="#eee"
22-
foregroundColor="#e6e6e6"
23-
viewBox="0 0 400 100"
24-
>
25-
<rect x="0" y="10" width="47%" height="6" rx="1.5" />
26-
<rect x="200" y="10" width="41%" height="6" rx="1.5" />
27-
<rect x="0" y="18" width="43%" height="6" rx="1.5" />
28-
<rect x="200" y="34" width="40%" height="6" rx="1.5" />
29-
<rect x="200" y="42" width="45%" height="6" rx="1.5" />
30-
<rect x="0" y="42" width="40%" height="6" rx="1.5" />
31-
<rect x="0" y="50" width="44%" height="6" rx="1.5" />
32-
</ContentLoader>
33-
)
11+
return (
12+
<ContentLoader
13+
speed={1}
14+
backgroundColor={theme.rowOdd}
15+
foregroundColor={theme.rowEven}
16+
viewBox="0 0 400 100"
17+
>
18+
<rect width="250" height="6" rx="1.5" />
19+
</ContentLoader>
20+
)
21+
}
22+
23+
const DiffLoader = () => {
24+
const theme = useTheme()
25+
26+
return (
27+
<ContentLoader
28+
speed={1}
29+
backgroundColor={theme.rowOdd}
30+
foregroundColor={theme.rowEven}
31+
viewBox="0 0 400 100"
32+
>
33+
<rect x="0" y="10" width="47%" height="6" rx="1.5" />
34+
<rect x="200" y="10" width="41%" height="6" rx="1.5" />
35+
<rect x="0" y="18" width="43%" height="6" rx="1.5" />
36+
<rect x="200" y="34" width="40%" height="6" rx="1.5" />
37+
<rect x="200" y="42" width="45%" height="6" rx="1.5" />
38+
<rect x="0" y="42" width="40%" height="6" rx="1.5" />
39+
<rect x="0" y="50" width="44%" height="6" rx="1.5" />
40+
</ContentLoader>
41+
)
42+
}
3443

3544
const Container = styled(motion.div)`
3645
margin-top: 16px;
3746
border: 1px solid ${({ theme }) => theme.border};
3847
border-radius: 3px;
3948
`
4049

41-
const Header = styled.div({
42-
color: '#24292e',
43-
backgroundColor: '#fafbfc',
44-
padding: '10px',
45-
height: '40px',
46-
})
50+
const Header = styled.div`
51+
background-color: ${({ theme }) => theme.background};
52+
padding: 10px;
53+
height: 40px;
54+
`
4755

4856
const DiffLoading = () => (
4957
<Container

src/components/common/DiffViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const TopContainer = styled.div`
2828

2929
const Link = styled.a`
3030
padding: 4px 15px;
31-
color: #1677ff;
31+
color: ${({ theme }) => theme.link};
3232
`
3333

3434
const getDiffKey = ({ oldRevision, newRevision }) =>

src/theme/index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const lightTheme = {
2-
background: '#ffffff',
2+
background: '#FFFFFF',
33

44
text: '#363537',
55
textHover: 'rgba(27, 31, 35, 0.6)',
@@ -11,9 +11,6 @@ export const lightTheme = {
1111
yellowBackground: '#fffbe6',
1212

1313
diff: {
14-
decoration: '#dbedff',
15-
16-
// Color object from https://github.com/otakustay/react-diff-view/blob/master/site/components/DiffView/diff.global.less
1714
textColor: '#000',
1815
selectionBackground: '#b3d7ff',
1916
gutterInsertBackground: '#cdffd8',
@@ -31,9 +28,9 @@ export const lightTheme = {
3128
decorationContent: '#999',
3229
},
3330

34-
// Alternating Row Colors for Binary Download component
35-
rowEven: '#fafbfc',
36-
rowOdd: '#ffffff',
31+
// Alternating Row Colors for Binary Download component and Content Loader animation
32+
rowEven: '#EEEEEE',
33+
rowOdd: '#FFFFFF',
3734

3835
// The completed files counter
3936
popover: {
@@ -46,18 +43,16 @@ export const darkTheme = {
4643
background: '#363537',
4744

4845
text: '#FAFAFA',
49-
textHover: '#999',
46+
textHover: '#999999',
5047
link: '#045dc1',
5148
linkHover: '#40a9ff',
5249

53-
border: '#888',
50+
border: '#555555',
5451
greenBorder: '#bef5cb',
5552
yellowBorder: '#c69026',
5653
yellowBackground: '#37332A',
5754

5855
diff: {
59-
decoration: '#dbedff',
60-
6156
// Color object from https://github.com/otakustay/react-diff-view/blob/master/site/components/DiffView/diff.global.less
6257
textColor: '#fafafa',
6358
selectionBackground: '#5a5f80',
@@ -76,10 +71,11 @@ export const darkTheme = {
7671
decorationContent: '#ababab',
7772
},
7873

79-
// Alternating Row Colors for Binary Download component
74+
// Alternating Row Colors for Binary Download component and Content Loader animation
8075
rowEven: '#363537',
8176
rowOdd: '#222223',
8277

78+
// The completed files counter
8379
popover: {
8480
text: '#7dadda',
8581
background: '#0E5699',

0 commit comments

Comments
 (0)