Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adactive/arc-itemcarousel

Package Overview
Dependencies
Maintainers
5
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adactive/arc-itemcarousel - npm Package Compare versions

Comparing version 0.0.2-y.44.58 to 0.0.2-y.44.59

20

cli.js
#!/usr/bin/env node
'use strict';

@@ -9,6 +8,5 @@ const chalk = require('chalk');

const commander = require('commander');
let cmdValue = '';
const program = require('commander');
program

@@ -18,3 +16,3 @@ .usage('npx @adactive/arc-itemCarousel copy')

.option('--less-only', 'just copy the style')
.action(function (cmd) {
.action((cmd) => {
cmdValue = cmd;

@@ -24,15 +22,13 @@ })

if(cmdValue === "copy") {
if(program.lessOnly) {
if (cmdValue === 'copy') {
if (program.lessOnly) {
fs.copy(`${__dirname}/src/adsumItemCarousel.less`, path.resolve('src/components/adsum-itemCarousel/adsumItemCarousel.less'))
.then(() => console.log(chalk.green("Success!")) )
.catch(err => console.error(err))
.then(() => console.log(chalk.green('Success!')))
.catch(err => console.error(err));
} else {
fs.copy(`${__dirname}/index.js`, path.resolve('src/components/adsum-itemCarousel/index.js'))
.then(() => fs.copy(`${__dirname}/src`, path.resolve('src/components/adsum-itemCarousel/src')))
.then(() => console.log(chalk.green("Success!")) )
.catch(err => console.error(err))
.then(() => console.log(chalk.green('Success!')))
.catch(err => console.error(err));
}
}

2

index.js
import AdsumItemCarousel from './src/AdsumItemCarousel';
export default AdsumItemCarousel;
export default AdsumItemCarousel;
{
"name": "@adactive/arc-itemcarousel",
"version": "0.0.2-y.44.58",
"version": "0.0.2-y.44.59",
"description": "Adsum Item Carousel Component",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,15 +20,15 @@ // @flow

type PropTypes = {|
+isOpen: boolean,
+items: Array<ItemObject>,
+itemsPerPage: number,
+onItemClicked: () => null,
+listWrapperCSS?: CSSStyleDeclaration,
+thumbNailWrapperCSS?: CSSStyleDeclaration,
+logoWrapperCSS?: CSSStyleDeclaration,
+logoCSS?: CSSStyleDeclaration,
+titleWrapperCSS?: CSSStyleDeclaration,
+titleCSS?: CSSStyleDeclaration,
+dashCSS?: CSSStyleDeclaration,
+carouselOptions?: Object,
+defaultLogo?: string
isOpen?: boolean,
items?: Array<ItemObject>,
itemsPerPage?: number,
onItemClicked?: () => null,
listWrapperCSS?: CSSStyleDeclaration,
thumbNailWrapperCSS?: CSSStyleDeclaration,
logoWrapperCSS?: CSSStyleDeclaration,
logoCSS?: CSSStyleDeclaration,
titleWrapperCSS?: CSSStyleDeclaration,
titleCSS?: CSSStyleDeclaration,
dashCSS?: CSSStyleDeclaration,
carouselOptions?: Object,
defaultLogo?: string
|};

@@ -45,27 +45,25 @@

itemsPerPage: 0,
onItemClicked: null
onItemClicked: null,
listWrapperCSS: {},
thumbNailWrapperCSS: {},
logoWrapperCSS: {},
logoCSS: {},
titleWrapperCSS: {},
titleCSS: {},
dashCSS: {},
carouselOptions: {},
defaultLogo: '',
};
constructor(props: PropTypes) {
super(props);
this.bindAll();
}
state = {
slideIndex: 0
}
slideIndex: 0,
};
bindAll() {
this.generateThumbNails = this.generateThumbNails.bind(this);
this.generatePagination = this.generatePagination.bind(this);
this.createPagination = this.createPagination.bind(this);
this.displayLogo = this.displayLogo.bind(this);
this.onItemClicked = this.onItemClicked.bind(this);
}
componentDidUpdate(prevProps: PropTypes) {
const { items } = this.props;
componentDidUpdate(prevProps: PropTypes) {
if (prevProps.items !== this.props.items) {
if (prevProps.items !== items) {
// eslint-disable-next-line react/no-did-update-set-state
this.setState({
slideIndex: 0
slideIndex: 0,
});

@@ -75,8 +73,8 @@ }

onItemClicked(item: ItemObject) {
onItemClicked = (item: ItemObject) => {
const { onItemClicked } = this.props;
onItemClicked(item);
}
};
createPagination(): Array<Array<ItemObject>> {
createPagination = (): Array<Array<ItemObject>> => {
const { items, itemsPerPage } = this.props;

@@ -110,23 +108,22 @@ let ret = [];

return pagination;
}
};
generatePagination(items: Array<Array<ItemObject>>): Array<Element<'ul'>> | Element<'ul'> {
generatePagination = (items: Array<Array<ItemObject>>): Array<Element<'ul'>> | Element<'ul'> => {
const { listWrapperCSS } = this.props;
if (items.length > 0) {
return _.map(items, (item: Array<ItemObject>, index: number) =>
return _.map(items, (item: Array<ItemObject>, index: number) => (
<ul className="row item" key={index} style={listWrapperCSS}>
{ this.generateThumbNails(item) }
{this.generateThumbNails(item)}
</ul>
)
} else {
return (
<ul className="row item" key="0" style={listWrapperCSS}>
<li className="no-result" >No items</li>
</ul>
);
));
}
}
return (
<ul className="row item" key="0" style={listWrapperCSS}>
<li className="no-result">No items</li>
</ul>
);
};
displayLogo(item: ItemObject): Element<'img'> | Element<'span'> {
displayLogo = (item: ItemObject): Element<'img'> | Element<'span'> => {
const { logoCSS, defaultLogo } = this.props;

@@ -136,19 +133,21 @@

return (
<img className="thumbnail-panel-logo" src={item.logo.uri} style={logoCSS}/>
<img className="thumbnail-panel-logo" src={item.logo.uri} alt="thumbnail panel logo" style={logoCSS} />
);
} else if (defaultLogo) {
}
if (defaultLogo) {
return (
<img className="thumbnail-panel-logo" src={defaultLogo} style={logoCSS}/>
<img className="thumbnail-panel-logo" src={defaultLogo} alt="thumbnail panel logo" style={logoCSS} />
);
} else {
return (
<span className="thumbnail-panel-logo" style={logoCSS}>{item.name}</span>
);
}
}
return (
<span className="thumbnail-panel-logo" style={logoCSS}>{item.name}</span>
);
};
generateThumbNails(items: Array<ItemObject>): Element<'li'> {
const { thumbNailWrapperCSS, logoWrapperCSS, titleWrapperCSS, dashCSS, titleCSS } = this.props;
generateThumbNails = (items: Array<ItemObject>): Element<'li'> => {
const {
thumbNailWrapperCSS, logoWrapperCSS, titleWrapperCSS, dashCSS, titleCSS,
} = this.props;
return _.map(items, (item: ItemObject, index: number) =>
return _.map(items, (item: ItemObject, index: number) => (
<li className="thumbnail-wrapper" key={index} onClick={(): void => this.onItemClicked(item)} style={thumbNailWrapperCSS}>

@@ -175,7 +174,8 @@ <span className="btn btn-standard width height">

</li>
);
}
));
};
render(): Node {
const { isOpen, carouselOptions } = this.props;
const { slideIndex } = this.state;

@@ -189,5 +189,6 @@ if (!isOpen) return null;

<div className="templateCarousel">
<Carousel {...carouselOptions}
slideIndex={this.state.slideIndex}
afterSlide={slideIndex => this.setState({ slideIndex })}
<Carousel
{...carouselOptions}
slideIndex={slideIndex}
afterSlide={newSlideIndex => this.setState({ slideIndex: newSlideIndex })}
>

@@ -194,0 +195,0 @@ {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc