File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,17 @@ import { Content } from './CardContent'
9
9
import { GlobalContext } from '../../context/GlobalState'
10
10
import { isLarge , isSmall } from '../../utils'
11
11
12
+ const Placeholder = styled ( 'span' ) ``
13
+
14
+ Placeholder . defaultProps = {
15
+ className : 'microlink_card_placeholder'
16
+ }
17
+
12
18
const MediaEmpty = styled ( CardImage ) `
13
19
${ emptyStateImageAnimation } ;
14
20
`
15
21
16
- const HeaderEmpty = styled ( 'span' ) `
22
+ const HeaderEmpty = styled ( Placeholder ) `
17
23
opacity: 0.8;
18
24
height: 16px;
19
25
width: ${ ( { cardSize } ) => ( ! isSmall ( cardSize ) ? '60%' : '75%' ) } ;
@@ -30,7 +36,7 @@ const HeaderEmpty = styled('span')`
30
36
` } ;
31
37
`
32
38
33
- const DescriptionEmpty = styled ( 'span' ) `
39
+ const DescriptionEmpty = styled ( Placeholder ) `
34
40
opacity: 0.8;
35
41
height: 14px;
36
42
width: 95%;
@@ -40,12 +46,13 @@ const DescriptionEmpty = styled('span')`
40
46
animation-delay: 0.125s;
41
47
`
42
48
43
- const FooterEmpty = styled ( 'span' ) `
49
+ const FooterEmpty = styled ( Placeholder ) `
44
50
opacity: 0.8;
45
51
height: 12px;
46
52
width: 30%;
47
53
display: block;
48
- ${ emptyStateAnimation } animation-delay: .25s;
54
+ ${ emptyStateAnimation } ;
55
+ animation-delay: 0.25s;
49
56
50
57
${ ( { cardSize } ) =>
51
58
! isLarge ( cardSize ) &&
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ const Card = props => {
39
39
setData,
40
40
url,
41
41
apiKey, // destructuring to avoid pass it
42
+ placeholderComponent : CardEmpty ,
42
43
...restProps
43
44
} = props
44
45
@@ -224,6 +225,7 @@ const Microlink = props => (
224
225
Microlink . defaultProps = {
225
226
className : '' ,
226
227
apiKey : undefined ,
228
+ placeholderComponent : CardEmpty ,
227
229
autoPlay : true ,
228
230
controls : true ,
229
231
direction : 'ltr' ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ storiesOf('props', module)
26
26
createStoryEntry ( { url, media : 'video' , controls : false } )
27
27
)
28
28
)
29
- . add ( 'loading' , ( ) => createStoryEntry ( { loading : true } ) )
29
+ . add ( 'loading' , ( ) => createStoryEntry ( { loading : true , fetchData : false } ) )
30
30
. add ( 'lazy' , ( ) => [
31
31
createStoryEntry ( { lazy : false } , true ) ,
32
32
createStoryEntry ( { lazy : { threshold : 1 } } , true )
You can’t perform that action at this time.
0 commit comments