File tree Expand file tree Collapse file tree 8 files changed +35
-29
lines changed Expand file tree Collapse file tree 8 files changed +35
-29
lines changed Original file line number Diff line number Diff line change @@ -8,15 +8,6 @@ export type WrapProps = {
88  children ?: React . ChildrenArray < * > , 
99}  &  ContentLoaderProps 
1010
11- export  const  defaultProps  =  { 
12-   speed : 2 , 
13-   width : 400 , 
14-   height : 130 , 
15-   primaryColor : '#f0f0f0' , 
16-   secondaryColor : '#e0e0e0' , 
17-   preserveAspectRatio : 'xMidYMid meet' , 
18- } 
19- 
2011const  Wrap  =  ( props : WrapProps ) : React . Element < * >  =>  { 
2112  const  idClip =  uid ( ) 
2213  const  idGradient  =  uid ( ) 
Original file line number Diff line number Diff line change 11//@flow  
22import  *  as  React  from  'react' 
3+ import  Wrap  from  './Wrap' 
34
4- import  Wrap ,  {  defaultProps  }  from  './Wrap' 
55// Stylized 
66export  {  default  as  Facebook  }  from  './stylized/FacebookStyle' 
77export  {  default  as  Instagram  }  from  './stylized/InstagramStyle' 
@@ -21,11 +21,23 @@ export type Props = {
2121  className : string , 
2222} 
2323
24+ const  defaultProps  =  { 
25+   speed : 2 , 
26+   width : 400 , 
27+   height : 130 , 
28+   primaryColor : '#f0f0f0' , 
29+   secondaryColor : '#e0e0e0' , 
30+   preserveAspectRatio : 'xMidYMid meet' , 
31+ } 
32+ 
33+ const  InitialComponent  =  props  =>  ( 
34+   < rect  x = "0"  y = "0"  rx = "5"  ry = "5"  width = { props . width }  height = { props . height }  /> 
35+ ) 
36+ 
2437const  ContentLoader  =  ( props : Props )  =>  { 
2538  const  mergedProps  =  {  ...defaultProps ,  ...props  } 
26-   const  children  =  props . children 
27-     ? props . children 
28-     : < rect  x = "0"  y = "0"  rx = "5"  ry = "5"  width = { mergedProps . width }  height = { mergedProps . height }  /> 
39+   const  children  =  props . children  ? props . children  : < InitialComponent  { ...mergedProps }  /> 
40+ 
2941  return  < Wrap  { ...mergedProps } > { children } </ Wrap > 
3042} 
3143
Original file line number Diff line number Diff line change 11//@flow  
22import  *  as  React  from  'react' 
3- import  Wrap ,   {   defaultProps   }   from  '../Wrap ' 
3+ import  ContentLoader   from  '../index ' 
44import  type  {  WrapProps  }  from  '../Wrap' 
55
66const  BulletListStyle  =  ( props : WrapProps ) : React . Element < * >  =>  ( 
7-   < Wrap  { ...defaultProps }   { ... props }   > 
7+   < ContentLoader  { ...props } > 
88    < circle  cx = "10"  cy = "20"  r = "8"  /> 
99    < rect  x = "25"  y = "15"  rx = "5"  ry = "5"  width = "220"  height = "10"  /> 
1010    < circle  cx = "10"  cy = "50"  r = "8"  /> 
@@ -13,7 +13,7 @@ const BulletListStyle = (props: WrapProps): React.Element<*> => (
1313    < rect  x = "25"  y = "75"  rx = "5"  ry = "5"  width = "220"  height = "10"  /> 
1414    < circle  cx = "10"  cy = "110"  r = "8"  /> 
1515    < rect  x = "25"  y = "105"  rx = "5"  ry = "5"  width = "220"  height = "10"  /> 
16-   </ Wrap > 
16+   </ ContentLoader > 
1717) 
1818
1919export  default  BulletListStyle 
Original file line number Diff line number Diff line change 11//@flow  
22import  *  as  React  from  'react' 
3- import  Wrap ,   {   defaultProps   }   from  '../Wrap ' 
3+ import  ContentLoader   from  '../index ' 
44import  type  {  WrapProps  }  from  '../Wrap' 
55
66const  CodeStyle  =  ( props : WrapProps ) : React . Element < * >  =>  ( 
7-   < Wrap  { ...defaultProps }   { ... props }   > 
7+   < ContentLoader  { ...props } > 
88    < rect  x = "0"  y = "0"  rx = "3"  ry = "3"  width = "70"  height = "10"  /> 
99    < rect  x = "80"  y = "0"  rx = "3"  ry = "3"  width = "100"  height = "10"  /> 
1010    < rect  x = "190"  y = "0"  rx = "3"  ry = "3"  width = "10"  height = "10"  /> 
@@ -17,7 +17,7 @@ const CodeStyle = (props: WrapProps): React.Element<*> => (
1717    < rect  x = "185"  y = "40"  rx = "3"  ry = "3"  width = "60"  height = "10"  /> 
1818
1919    < rect  x = "0"  y = "60"  rx = "3"  ry = "3"  width = "30"  height = "10"  /> 
20-   </ Wrap > 
20+   </ ContentLoader > 
2121) 
2222
2323export  default  CodeStyle 
Original file line number Diff line number Diff line change 11//@flow  
22import  *  as  React  from  'react' 
3- import  Wrap ,   {   defaultProps   }   from  '../Wrap ' 
3+ import  ContentLoader   from  '../index ' 
44import  type  {  WrapProps  }  from  '../Wrap' 
55
66const  FacebookStyle  =  ( props : WrapProps ) : React . Element < * >  =>  ( 
7-   < Wrap  { ...defaultProps }   { ... props }   > 
7+   < ContentLoader  { ...props } > 
88    < rect  x = "70"  y = "15"  rx = "4"  ry = "4"  width = "117"  height = "6.4"  /> 
99    < rect  x = "70"  y = "35"  rx = "3"  ry = "3"  width = "85"  height = "6.4"  /> 
1010    < rect  x = "0"  y = "80"  rx = "3"  ry = "3"  width = "350"  height = "6.4"  /> 
1111    < rect  x = "0"  y = "100"  rx = "3"  ry = "3"  width = "380"  height = "6.4"  /> 
1212    < rect  x = "0"  y = "120"  rx = "3"  ry = "3"  width = "201"  height = "6.4"  /> 
1313    < circle  cx = "30"  cy = "30"  r = "30"  /> 
14-   </ Wrap > 
14+   </ ContentLoader > 
1515) 
1616
1717export  default  FacebookStyle 
Original file line number Diff line number Diff line change 11//@flow  
22import  *  as  React  from  'react' 
3- import  Wrap ,   {   defaultProps   }   from  '../Wrap ' 
3+ import  ContentLoader   from  '../index ' 
44import  type  {  WrapProps  }  from  '../Wrap' 
55
66const  InstagramStyle  =  ( props : WrapProps ) : React . Element < * >  =>  ( 
7-   < Wrap   { ... defaultProps }  { ...props }  height = { 480 } > 
7+   < ContentLoader  { ...props }  height = { 480 } > 
88    < circle  cx = "30"  cy = "30"  r = "30"  /> 
99
1010    < rect  x = "75"  y = "13"  rx = "4"  ry = "4"  width = "100"  height = "13"  /> 
1111    < rect  x = "75"  y = "37"  rx = "4"  ry = "4"  width = "50"  height = "8"  /> 
1212    < rect  x = "0"  y = "70"  rx = "5"  ry = "5"  width = "400"  height = "400"  /> 
13-   </ Wrap > 
13+   </ ContentLoader > 
1414) 
1515
1616export  default  InstagramStyle 
Original file line number Diff line number Diff line change 11//@flow  
22import  *  as  React  from  'react' 
3- import  Wrap ,   {   defaultProps   }   from  '../Wrap ' 
3+ import  ContentLoader   from  '../index ' 
44import  type  {  WrapProps  }  from  '../Wrap' 
55
66const  ListStyle  =  ( props : WrapProps ) : React . Element < * >  =>  ( 
7-   < Wrap   { ... defaultProps }  { ...props } > 
7+   < ContentLoader  { ...props } > 
88    < rect  x = "0"  y = "0"  rx = "3"  ry = "3"  width = "250"  height = "10"  /> 
99    < rect  x = "20"  y = "20"  rx = "3"  ry = "3"  width = "220"  height = "10"  /> 
1010    < rect  x = "20"  y = "40"  rx = "3"  ry = "3"  width = "170"  height = "10"  /> 
1111    < rect  x = "0"  y = "60"  rx = "3"  ry = "3"  width = "250"  height = "10"  /> 
1212    < rect  x = "20"  y = "80"  rx = "3"  ry = "3"  width = "200"  height = "10"  /> 
1313    < rect  x = "20"  y = "100"  rx = "3"  ry = "3"  width = "80"  height = "10"  /> 
14-   </ Wrap > 
14+   </ ContentLoader > 
1515) 
1616
1717export  default  ListStyle 
Original file line number Diff line number Diff line change 11// @flow  
2- export  default  ( ) : string  =>  Math . random ( ) . toString ( 36 ) . substring ( 2 ) 
2+ export  default  ( ) : string  => 
3+   Math . random ( ) 
4+     . toString ( 36 ) 
5+     . substring ( 2 ) 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments