@adactive/arc-itemcarousel
Advanced tools
Comparing version 0.0.2-y.44.2 to 0.0.2-y.44.3
{ | ||
"name": "@adactive/arc-itemcarousel", | ||
"version": "0.0.2-y.44.2", | ||
"version": "0.0.2-y.44.3", | ||
"description": "Adsum Item Carousel Component", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,3 +16,3 @@ // @flow | ||
+name: string, | ||
+logo: LogoObject | ||
+logo?: LogoObject | ||
}; | ||
@@ -25,7 +25,10 @@ | ||
+onItemClicked: () => null, | ||
logoCSS?: Object, | ||
titleCSS?: Object, | ||
dashCSS?: Object, | ||
carouselDecorators?: Array<Object>, | ||
carouselOptions?: Object | ||
+thumbNailWrapperCSS?: CSSStyleDeclaration, | ||
+logoWrapperCSS?: CSSStyleDeclaration, | ||
+logoCSS?: CSSStyleDeclaration, | ||
+titleWrapperCSS?: CSSStyleDeclaration, | ||
+titleCSS?: CSSStyleDeclaration, | ||
+dashCSS?: CSSStyleDeclaration, | ||
+carouselDecorators?: Array<Object>, | ||
+carouselOptions?: Object | ||
|}; | ||
@@ -38,8 +41,3 @@ | ||
itemsPerPage: 0, | ||
onItemClicked: null, | ||
logoCSS: {}, | ||
titleCSS: {}, | ||
dashCSS: {}, | ||
carouselDecorators: [], | ||
carouselOptions: {} | ||
onItemClicked: null | ||
}; | ||
@@ -61,7 +59,2 @@ | ||
componentDidMount() { | ||
const { items } = this.props; | ||
console.log('[COMPONENT DID MOUNT - CHECKING DATA] : ', items); | ||
} | ||
onItemClicked(item: ItemObject) { | ||
@@ -93,67 +86,61 @@ const { onItemClicked } = this.props; | ||
console.log(pagination); | ||
return pagination; | ||
} | ||
generatePagination(items: Array<Array<ItemObject>>) { | ||
const ret = []; | ||
generatePagination(items: Array<Array<ItemObject>>): Array<Element<'ul'>> | Element<'ul'> { | ||
if (items.length > 0) { | ||
_.each(items, (item: Array<ItemObject>, index: number) => { | ||
ret.push( | ||
<ul className="row item" key={index}> | ||
{ this.generateThumbNails(item) } | ||
</ul> | ||
); | ||
}); | ||
return _.map(items, (item: Array<ItemObject>, index: number) => | ||
<ul className="row item" key={index}> | ||
{ this.generateThumbNails(item) } | ||
</ul> | ||
) | ||
} else { | ||
ret.push( | ||
return ( | ||
<ul className="row item" key="0"> | ||
<li className="no-result" >No items</li> | ||
</ul>); | ||
</ul> | ||
); | ||
} | ||
return ret; | ||
} | ||
displayLogo(item: ItemObject) { | ||
displayLogo(item: ItemObject): Element<'img'> | Element<'span'> { | ||
const { logoCSS } = this.props; | ||
if (item.logo && item.logo.uri) { | ||
return ( | ||
<img className="thumbnail-panel-logo" src={item.logo.uri} /> | ||
<img className="thumbnail-panel-logo" src={item.logo.uri} style={logoCSS}/> | ||
); | ||
} else { | ||
return ( | ||
<span className="thumbnail-panel-logo" style={logoCSS}>{item.name}</span> | ||
); | ||
} | ||
return ( | ||
<span className="thumbnail-panel-logo">{item.name}</span> | ||
); | ||
} | ||
generateThumbNails(items: Array<ItemObject>) { | ||
const { logoCSS, titleCSS, dashCSS } = this.props; | ||
const ret = []; | ||
_.each(items, (item: ItemObject, index: number) => { | ||
ret.push( | ||
<li className="col-md-3 thumbnail-wrapper" key={index} onClick={(): void => this.onItemClicked(item)}> | ||
<span className="btn btn-standard width height"> | ||
<div className="flex-center"> | ||
<div className="thumbnail-panel"> | ||
<div className="thumbnail-panel-logo-div" style={logoCSS}> | ||
{ | ||
this.displayLogo(item) | ||
} | ||
generateThumbNails(items: Array<ItemObject>): Element<'li'> { | ||
const { thumbNailWrapperCSS, logoWrapperCSS, titleWrapperCSS, dashCSS, titleCSS } = this.props; | ||
return _.map(items, (item: ItemObject, index: number) => | ||
<li className="col-md-3 thumbnail-wrapper" key={index} onClick={(): void => this.onItemClicked(item)} style={thumbNailWrapperCSS}> | ||
<span className="btn btn-standard width height"> | ||
<div className="flex-center"> | ||
<div className="thumbnail-panel"> | ||
<div className="thumbnail-panel-logo-div" style={logoWrapperCSS}> | ||
{ | ||
this.displayLogo(item) | ||
} | ||
</div> | ||
<div className="thumbnail-panel-title-div" style={titleWrapperCSS}> | ||
<div className="thumbnail-panel-dash-div"> | ||
<span className="thumbnail-panel-dash" style={dashCSS} /> | ||
</div> | ||
<div className="thumbnail-panel-title-div" style={titleCSS}> | ||
<div className="thumbnail-panel-dash-div"> | ||
<span className="thumbnail-panel-dash" style={dashCSS} /> | ||
</div> | ||
<div className="thumbnail-panel-title-wrapper"> | ||
<span className="thumbnail-panel-title" style={titleCSS}>{item.name}</span> | ||
</div> | ||
<div className="thumbnail-panel-title-wrapper"> | ||
<span className="thumbnail-panel-title" style={titleCSS}>{item.name}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</span> | ||
</li>); | ||
}); | ||
return ret; | ||
</div> | ||
</span> | ||
</li> | ||
); | ||
} | ||
@@ -160,0 +147,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23916
111
359