Skip to content

Commit 800acdf

Browse files
authored
fix: update slider new md, add classname to slider (#969)
1 parent 469b62d commit 800acdf

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/blocks/SliderNew/Slider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const SliderNewBlock = ({
5050
adaptive,
5151
autoplay: autoplayMs,
5252
dots = true,
53+
className,
5354
dotsClassName,
5455
disclaimer,
5556
children,
@@ -90,7 +91,7 @@ export const SliderNewBlock = ({
9091
/>
9192
<AnimateBlock className={b('animate-slides')} animate={animated}>
9293
<Swiper
93-
className={b('slider')}
94+
className={b('slider', className)}
9495
onSwiper={onSwiper}
9596
pagination={
9697
dots && {

src/blocks/SliderNew/__stories__/Slider.mdx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@ import * as SliderStories from './Slider.stories.tsx';
55

66
<Meta of={SliderStories} />
77
<StoryTemplate>
8+
9+
##### Slider new block. based on [swiper](https://v6.swiperjs.com/react) library.
10+
<br/><br/>
11+
812
## Parameters
913

1014
The slider supports two types of content: loadable and from a config. Loadable content is loaded via the `loadable` property and content from a config via the `children` property.
1115

12-
`type: "slider-block"`
16+
`type: "slider-new-block"`
1317

1418
`animated?: bool` — Enables/disables animation for the block (enabled by default).
1519

1620
`dots?: bool` — A flag that indicates whether to show navigation dots.
1721

1822
`arrows? bool` — A flag that indicates whether to show navigation arrows.
1923

20-
`title: Title`: Title.
24+
`title: Title` Title.
2125

22-
`description?: string`: Description.
26+
`description?: string` Description.
2327

24-
`randomOrder?: bool`: Enables a random slide order.
28+
`randomOrder?: bool` Enables a random slide order.
2529

26-
`slidesToShow?: Record<'all' | 'sm' | 'md' | 'lg' | 'xl', number> | number`: How many slides to show on screens of different width. Overrides the default values. They can be overridden for each screen width. You can also set a single numeric value so that the number of slides is always the same (except for mobiles, where the value is always 1).
30+
`slidesToShow?: Record<'all' | 'sm' | 'md' | 'lg' | 'xl', number> | number` How many slides to show on screens of different width. Overrides the default values. They can be overridden for each screen width. You can also set a single numeric value so that the number of slides is always the same (except for mobiles, where the value is always 1).
2731

2832
Default values:
2933

@@ -32,6 +36,14 @@ Default values:
3236
- `md`: 2
3337
- `sm`: 1
3438

39+
`type?: string` — Currently supported: `"media-card" | "header-card"`.
40+
41+
`autoplay?: number` — Autoplay delay between transitions in ms.
42+
43+
`arrowSize?: number` - Size of arrow icons. Default: `16`.
44+
45+
`adaptive?: boolean` - Adapt slider height to the height of the active slide. Default: `false`.
46+
3547
`loadable: Loadable` — Loadable content, the following data sources are currently supported:
3648

3749
- `events` — Events.
@@ -50,4 +62,5 @@ The following blocks are currently supported:
5062
- [`MediaCard` — Card with an image](?path=/story/блоки-media--default&viewMode=docs)
5163
- [`PriceCard` — Price card](?path=/story/components-cards-pricecard--default&viewMode=docs)
5264

65+
`onSlideChange | onSlideChangeTransitionStart | onSlideChangeTransitionEnd | onActiveIndexChange | onBreakpoint` [events](https://v6.swiperjs.com/swiper-api#events) supported. If you need more please open an [issue](https://github.com/gravity-ui/page-constructor/issues) or make PR.
5366
</StoryTemplate>

0 commit comments

Comments
 (0)