Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit bf4aa77

Browse files
committed
fix(LoadingBar): add JobItemLoadingBar
1 parent 620d113 commit bf4aa77

File tree

4 files changed

+60
-2
lines changed

4 files changed

+60
-2
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React from 'react'
2+
import R from 'ramda'
3+
import PropTypes from 'prop-types'
4+
import styled, { withTheme } from 'styled-components'
5+
import ContentLoader from 'react-content-loader'
6+
7+
import { uid } from '../../utils'
8+
9+
// Config-page: http://danilowoz.com/create-react-content-loader/
10+
const LoadingWrapper = styled.div`
11+
width: 100%;
12+
overflow: hidden;
13+
`
14+
15+
const LoadingItem = ({ theme }) => (
16+
<ContentLoader
17+
height={63}
18+
width={500}
19+
speed={2}
20+
primaryColor={theme.loading.basic}
21+
secondaryColor={theme.loading.animate}
22+
>
23+
<rect x="283.02" y="141.21" rx="4" ry="4" width="86.5" height="9" />
24+
<rect x="6" y="7.2" rx="0" ry="0" width="205" height="9" />
25+
<rect x="6" y="26.2" rx="0" ry="0" width="89" height="8" />
26+
<rect x="105" y="28.2" rx="0" ry="0" width="81" height="7" />
27+
<rect x="6" y="43.2" rx="0" ry="0" width="197" height="7" />
28+
<rect x="283" y="7.25" rx="0" ry="0" width="136.8" height="8.52" />
29+
<rect x="283" y="41.2" rx="0" ry="0" width="98.28" height="7.99" />
30+
<rect x="457.36" y="8.2" rx="0" ry="0" width="38.68" height="37.84" />
31+
<rect x="283" y="24.2" rx="0" ry="0" width="34" height="8.58" />
32+
<rect x="327.44" y="24.2" rx="0" ry="0" width="27" height="8.58" />
33+
<rect x="364.44" y="24.2" rx="0" ry="0" width="34" height="8.58" />
34+
</ContentLoader>
35+
)
36+
37+
const JobItemLoading = ({ num, theme }) => {
38+
// const ukey = uid.gen()
39+
const range = R.range(0, num)
40+
return range.map(() => (
41+
<LoadingWrapper key={uid.gen()}>
42+
<LoadingItem uniquekey={uid.gen()} theme={theme} />
43+
</LoadingWrapper>
44+
))
45+
}
46+
47+
JobItemLoading.propTypes = {
48+
num: PropTypes.number,
49+
}
50+
51+
JobItemLoading.defaultProps = {
52+
num: 1,
53+
}
54+
55+
export default withTheme(JobItemLoading)

components/LoadingEffects/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export { default as CommentLoading } from './CommentLoading'
99
export { default as PostItemLoading } from './PostItemLoading'
1010
export { default as VideoItemLoading } from './VideoItemLoading'
1111
export { default as RepoItemLoading } from './RepoItemLoading'
12+
export { default as JobItemLoading } from './JobItemLoading'
1213
export { default as TypeWriterLoading } from './TypeWriterLoading'
1314

1415
export { default as ArticleContentLoading } from './ArticleContentLoading'

components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export {
5252
PostItemLoading,
5353
VideoItemLoading,
5454
RepoItemLoading,
55+
JobItemLoading,
5556
TypeWriterLoading,
5657
ArticleContentLoading,
5758
} from './LoadingEffects'

containers/JobsThread/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import TagsBar from '../TagsBar'
1414

1515
import {
1616
Affix,
17-
PostItemLoading,
17+
JobItemLoading,
1818
Pagi,
1919
EmptyThread,
2020
ContentFilter,
@@ -47,6 +47,7 @@ const View = ({ community, thread, entries, curView, active }) => {
4747
case TYPE.RESULT: {
4848
return (
4949
<React.Fragment>
50+
<JobItemLoading num={1} />
5051
{entries.map(entry => (
5152
<JobItem
5253
entry={entry}
@@ -66,7 +67,7 @@ const View = ({ community, thread, entries, curView, active }) => {
6667
)
6768
}
6869
default:
69-
return <PostItemLoading num={3} />
70+
return <JobItemLoading num={3} />
7071
}
7172
}
7273

0 commit comments

Comments
 (0)