Skip to content

Commit

Permalink
feat: relocate Slider atom from web
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzhastin-Nikita authored and the-homeless-god committed May 26, 2022
1 parent 63ba011 commit 3a5760b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/atoms/Slider/Slider.styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import 'src/scss/mixins';

.slider {
@include flex-center;

width: 100%;
}
35 changes: 35 additions & 0 deletions src/components/atoms/Slider/Slider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react'

import cx from 'classnames'
import { Navigation, Pagination, Scrollbar, A11y } from 'swiper'

// eslint-disable-next-line import/no-unresolved
import { Swiper } from 'swiper/react'

import css from './Slider.styles.module.scss'

export type SliderProps = {
className?: string
children?: React.ReactNode
slidesPerView?: number
spaceBetween?: number
autoplay?: boolean
}

export const Slider = ({ className, autoplay, children, slidesPerView = 1, spaceBetween = 1 }: SliderProps) => {
return (
<div className={cx(css.slider, className)}>
<Swiper
autoplay={autoplay}
modules={[Navigation, Pagination, Scrollbar, A11y]}
spaceBetween={spaceBetween}
slidesPerView={slidesPerView}
navigation
pagination={{ clickable: true }}
scrollbar={{ draggable: true }}
>
{children}
</Swiper>
</div>
)
}
1 change: 1 addition & 0 deletions src/components/atoms/Slider/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Slider'

0 comments on commit 3a5760b

Please sign in to comment.