File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,15 @@ import { Content } from './CardContent'
99import { GlobalContext } from '../../context/GlobalState'
1010import { isLarge , isSmall } from '../../utils'
1111
12+ const Placeholder = styled . span . attrs ( {
13+ className : 'microlink_card_placeholder'
14+ } ) ``
15+
1216const MediaEmpty = styled ( CardImage ) `
1317 ${ emptyStateImageAnimation } ;
1418`
1519
16- const HeaderEmpty = styled ( 'span' ) `
20+ const HeaderEmpty = styled ( Placeholder ) `
1721 opacity: 0.8;
1822 height: 16px;
1923 width: ${ ( { cardSize } ) => ( ! isSmall ( cardSize ) ? '60%' : '75%' ) } ;
@@ -30,7 +34,7 @@ const HeaderEmpty = styled('span')`
3034 ` } ;
3135`
3236
33- const DescriptionEmpty = styled ( 'span' ) `
37+ const DescriptionEmpty = styled ( Placeholder ) `
3438 opacity: 0.8;
3539 height: 14px;
3640 width: 95%;
@@ -40,12 +44,13 @@ const DescriptionEmpty = styled('span')`
4044 animation-delay: 0.125s;
4145`
4246
43- const FooterEmpty = styled ( 'span' ) `
47+ const FooterEmpty = styled ( Placeholder ) `
4448 opacity: 0.8;
4549 height: 12px;
4650 width: 30%;
4751 display: block;
48- ${ emptyStateAnimation } animation-delay: .25s;
52+ ${ emptyStateAnimation } ;
53+ animation-delay: 0.25s;
4954
5055 ${ ( { cardSize } ) =>
5156 ! 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