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'
99import { GlobalContext } from '../../context/GlobalState'
1010import { isLarge , isSmall } from '../../utils'
1111
12+ const Placeholder = styled ( 'span' ) ``
13+
14+ Placeholder . defaultProps = {
15+ className : 'microlink_card_placeholder'
16+ }
17+
1218const MediaEmpty = styled ( CardImage ) `
1319 ${ emptyStateImageAnimation } ;
1420`
1521
16- const HeaderEmpty = styled ( 'span' ) `
22+ const HeaderEmpty = styled ( Placeholder ) `
1723 opacity: 0.8;
1824 height: 16px;
1925 width: ${ ( { cardSize } ) => ( ! isSmall ( cardSize ) ? '60%' : '75%' ) } ;
@@ -30,7 +36,7 @@ const HeaderEmpty = styled('span')`
3036 ` } ;
3137`
3238
33- const DescriptionEmpty = styled ( 'span' ) `
39+ const DescriptionEmpty = styled ( Placeholder ) `
3440 opacity: 0.8;
3541 height: 14px;
3642 width: 95%;
@@ -40,12 +46,13 @@ const DescriptionEmpty = styled('span')`
4046 animation-delay: 0.125s;
4147`
4248
43- const FooterEmpty = styled ( 'span' ) `
49+ const FooterEmpty = styled ( Placeholder ) `
4450 opacity: 0.8;
4551 height: 12px;
4652 width: 30%;
4753 display: block;
48- ${ emptyStateAnimation } animation-delay: .25s;
54+ ${ emptyStateAnimation } ;
55+ animation-delay: 0.25s;
4956
5057 ${ ( { cardSize } ) =>
5158 ! isLarge ( cardSize ) &&
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ const Card = props => {
3939 setData,
4040 url,
4141 apiKey, // destructuring to avoid pass it
42+ placeholderComponent : CardEmpty ,
4243 ...restProps
4344 } = props
4445
@@ -224,6 +225,7 @@ const Microlink = props => (
224225Microlink . defaultProps = {
225226 className : '' ,
226227 apiKey : undefined ,
228+ placeholderComponent : CardEmpty ,
227229 autoPlay : true ,
228230 controls : true ,
229231 direction : 'ltr' ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ storiesOf('props', module)
2626 createStoryEntry ( { url, media : 'video' , controls : false } )
2727 )
2828 )
29- . add ( 'loading' , ( ) => createStoryEntry ( { loading : true } ) )
29+ . add ( 'loading' , ( ) => createStoryEntry ( { loading : true , fetchData : false } ) )
3030 . add ( 'lazy' , ( ) => [
3131 createStoryEntry ( { lazy : false } , true ) ,
3232 createStoryEntry ( { lazy : { threshold : 1 } } , true )
You can’t perform that action at this time.
0 commit comments