Replicating InfinityCarousel and fixing outdated bugfixes, css changes
This commit is contained in:
41
src/components/Carousel/InfiniteCarouselArrow.js
Normal file
41
src/components/Carousel/InfiniteCarouselArrow.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
function InfiniteCarouselArrow({ next, onClick, styles }) {
|
||||
const arrowClassName = styles.InfiniteCarouselArrow
|
||||
let typeClassName
|
||||
if (next) {
|
||||
typeClassName = styles.InfiniteCarouselArrowNext
|
||||
} else {
|
||||
typeClassName = styles.InfiniteCarouselArrowPrev
|
||||
}
|
||||
|
||||
const iconClassName = styles.InfiniteCarouselArrowIcon
|
||||
let iconTypeClassName
|
||||
if (next) {
|
||||
iconTypeClassName = styles.InfiniteCarouselArrowNextIcon
|
||||
} else {
|
||||
iconTypeClassName = styles.InfiniteCarouselArrowPrevIcon
|
||||
}
|
||||
|
||||
const className = `${arrowClassName} ${typeClassName}`
|
||||
const classNameIcon = `${iconClassName} ${iconTypeClassName}`
|
||||
|
||||
return (
|
||||
<button className={className} onClick={onClick}>
|
||||
<i className={classNameIcon} />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
InfiniteCarouselArrow.propTypes = {
|
||||
next: PropTypes.bool,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
styles: PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
InfiniteCarouselArrow.defaultProps = {
|
||||
next: true,
|
||||
}
|
||||
|
||||
export default InfiniteCarouselArrow
|
||||
Reference in New Issue
Block a user