-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathCardEmpty.js
83 lines (72 loc) · 1.8 KB
/
CardEmpty.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* eslint-disable multiline-ternary */
import React, { useContext } from 'react'
import { styled } from 'styled-components'
import { emptyStateAnimation, emptyStateImageAnimation } from './CardAnimation'
import CardImage from './CardMedia/Image'
import { Content } from './CardContent'
import { GlobalContext } from '../../context/GlobalState'
import { isLarge, isSmall } from '../../utils'
const MediaEmpty = styled(CardImage)`
${emptyStateImageAnimation};
`
const HeaderEmpty = styled('span')`
opacity: 0.8;
height: 16px;
width: ${({ $cardSize }) => (!isSmall($cardSize) ? '60%' : '75%')};
display: block;
background: #e1e8ed;
margin: ${({ $cardSize }) =>
!isSmall($cardSize) ? '2px 0 8px' : '0 20px 0 0'};
${emptyStateAnimation};
${({ $cardSize }) =>
!isLarge($cardSize) &&
`
height: 15px;
`};
`
const DescriptionEmpty = styled('span')`
opacity: 0.8;
height: 14px;
width: 95%;
display: block;
position: relative;
${emptyStateAnimation};
animation-delay: 0.125s;
`
const FooterEmpty = styled('span')`
opacity: 0.8;
height: 12px;
width: 30%;
display: block;
${emptyStateAnimation} animation-delay: .25s;
${({ $cardSize }) =>
!isLarge($cardSize) &&
`
height: 10px;
`};
`
const CardEmptyState = () => {
const {
props: { size }
} = useContext(GlobalContext)
const isSmallCard = isSmall(size)
return (
<>
<MediaEmpty $cardSize={size} />
<Content $cardSize={size}>
<HeaderEmpty $cardSize={size} />
{!isSmallCard ? (
<>
<DescriptionEmpty $cardSize={size} />
<DescriptionEmpty
$cardSize={size}
style={{ marginBottom: '12px' }}
/>
</>
) : null}
<FooterEmpty />
</Content>
</>
)
}
export default CardEmptyState