@meduza/ui-kit-2 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RelatedCarousel/RelatedCarousel.types.d.ts +5 -0
- package/dist/RelatedCarousel/index.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/ui-kit-2.cjs.development.js +347 -241
- package/dist/ui-kit-2.cjs.development.js.map +1 -1
- package/dist/ui-kit-2.cjs.production.min.js +1 -1
- package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
- package/dist/ui-kit-2.esm.js +347 -242
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit-game.css +109 -0
- package/dist/ui-kit.css +109 -0
- package/package.json +1 -1
- package/src/Lazy/index.tsx +7 -20
- package/src/RelatedBook/RelatedBook.module.css +15 -0
- package/src/RelatedBook/index.tsx +3 -4
- package/src/RelatedCarousel/RelatedCarousel.module.css +90 -0
- package/src/RelatedCarousel/RelatedCarousel.stories.module.css +53 -0
- package/src/RelatedCarousel/RelatedCarousel.stories.tsx +48 -0
- package/src/RelatedCarousel/RelatedCarousel.test.tsx +27 -0
- package/src/RelatedCarousel/RelatedCarousel.types.ts +6 -0
- package/src/RelatedCarousel/index.tsx +167 -0
- package/src/RelatedCarousel/mock.json +17 -0
- package/src/index.tsx +1 -0
package/dist/ui-kit-game.css
CHANGED
|
@@ -6796,6 +6796,24 @@ ul.VersesBlock-module_root__CrgSZ:first-child {
|
|
|
6796
6796
|
--metaFill: currentColor;
|
|
6797
6797
|
}
|
|
6798
6798
|
|
|
6799
|
+
@media only screen and (min-width: 32em) {
|
|
6800
|
+
|
|
6801
|
+
.RelatedBook-module_mobile__7rm-n {
|
|
6802
|
+
display: none;
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
.RelatedBook-module_desktop__OZ9Jx {
|
|
6807
|
+
display: none;
|
|
6808
|
+
}
|
|
6809
|
+
|
|
6810
|
+
@media only screen and (min-width: 32em) {
|
|
6811
|
+
|
|
6812
|
+
.RelatedBook-module_desktop__OZ9Jx {
|
|
6813
|
+
display: flex;
|
|
6814
|
+
}
|
|
6815
|
+
}
|
|
6816
|
+
|
|
6799
6817
|
.ListViewSwitcher-module_root__pBsR5 {
|
|
6800
6818
|
position: relative;
|
|
6801
6819
|
|
|
@@ -6908,6 +6926,97 @@ ul.VersesBlock-module_root__CrgSZ:first-child {
|
|
|
6908
6926
|
transform: translateX(16px);
|
|
6909
6927
|
}
|
|
6910
6928
|
|
|
6929
|
+
.RelatedCarousel-module_root__G-Eub {
|
|
6930
|
+
position: relative;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
.RelatedCarousel-module_track__UVQ2n {
|
|
6934
|
+
display: flex;
|
|
6935
|
+
gap: 20px;
|
|
6936
|
+
|
|
6937
|
+
margin: 0 -20px;
|
|
6938
|
+
padding: 0 20px;
|
|
6939
|
+
|
|
6940
|
+
overflow-x: auto;
|
|
6941
|
+
|
|
6942
|
+
list-style: none;
|
|
6943
|
+
overscroll-behavior-x: contain;
|
|
6944
|
+
|
|
6945
|
+
scroll-snap-type: x mandatory;
|
|
6946
|
+
scroll-padding-left: 20px;
|
|
6947
|
+
-webkit-overflow-scrolling: touch;
|
|
6948
|
+
|
|
6949
|
+
scrollbar-width: none;
|
|
6950
|
+
}
|
|
6951
|
+
|
|
6952
|
+
.RelatedCarousel-module_track__UVQ2n::-webkit-scrollbar {
|
|
6953
|
+
display: none;
|
|
6954
|
+
}
|
|
6955
|
+
|
|
6956
|
+
.RelatedCarousel-module_slide__MI9tF {
|
|
6957
|
+
position: relative;
|
|
6958
|
+
|
|
6959
|
+
flex: 0 0 85%;
|
|
6960
|
+
min-width: 0;
|
|
6961
|
+
|
|
6962
|
+
overflow: hidden;
|
|
6963
|
+
|
|
6964
|
+
scroll-snap-align: start;
|
|
6965
|
+
scroll-snap-stop: always;
|
|
6966
|
+
}
|
|
6967
|
+
|
|
6968
|
+
.RelatedCarousel-module_dots__mOSIC {
|
|
6969
|
+
--dotStep: 7px;
|
|
6970
|
+
|
|
6971
|
+
width: calc(var(--dotsVisible) * var(--dotStep));
|
|
6972
|
+
margin: 28px auto 0;
|
|
6973
|
+
|
|
6974
|
+
overflow: hidden;
|
|
6975
|
+
}
|
|
6976
|
+
|
|
6977
|
+
.RelatedCarousel-module_dotsTrack__V7bnX {
|
|
6978
|
+
display: flex;
|
|
6979
|
+
|
|
6980
|
+
transform: translateX(calc(var(--dotsStart) * var(--dotStep) * -1));
|
|
6981
|
+
|
|
6982
|
+
transition: transform 0.25s ease;
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6985
|
+
.RelatedCarousel-module_dotCell__kl64s {
|
|
6986
|
+
display: flex;
|
|
6987
|
+
flex: 0 0 auto;
|
|
6988
|
+
align-items: center;
|
|
6989
|
+
justify-content: center;
|
|
6990
|
+
|
|
6991
|
+
width: var(--dotStep);
|
|
6992
|
+
height: var(--dotStep);
|
|
6993
|
+
}
|
|
6994
|
+
|
|
6995
|
+
.RelatedCarousel-module_dot__Jo52r {
|
|
6996
|
+
width: 4px;
|
|
6997
|
+
height: 4px;
|
|
6998
|
+
|
|
6999
|
+
background-color: #d4d4d4;
|
|
7000
|
+
|
|
7001
|
+
border-radius: 50%;
|
|
7002
|
+
|
|
7003
|
+
transition: width 0.25s ease, height 0.25s ease, background-color 0.2s;
|
|
7004
|
+
}
|
|
7005
|
+
|
|
7006
|
+
.RelatedCarousel-module_isSmall__ZP5hd {
|
|
7007
|
+
width: 2px;
|
|
7008
|
+
height: 2px;
|
|
7009
|
+
}
|
|
7010
|
+
|
|
7011
|
+
.RelatedCarousel-module_isTiny__mjhtD {
|
|
7012
|
+
width: 1px;
|
|
7013
|
+
height: 1px;
|
|
7014
|
+
}
|
|
7015
|
+
|
|
7016
|
+
.RelatedCarousel-module_isActive__Nz2aj {
|
|
7017
|
+
background-color: #000;
|
|
7018
|
+
}
|
|
7019
|
+
|
|
6911
7020
|
.ToolbarButton-module_root__upsEH {
|
|
6912
7021
|
display: block;
|
|
6913
7022
|
|
package/dist/ui-kit.css
CHANGED
|
@@ -6796,6 +6796,24 @@ ul.VersesBlock-module_root__CrgSZ:first-child {
|
|
|
6796
6796
|
--metaFill: currentColor;
|
|
6797
6797
|
}
|
|
6798
6798
|
|
|
6799
|
+
@media only screen and (min-width: 32em) {
|
|
6800
|
+
|
|
6801
|
+
.RelatedBook-module_mobile__7rm-n {
|
|
6802
|
+
display: none;
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
.RelatedBook-module_desktop__OZ9Jx {
|
|
6807
|
+
display: none;
|
|
6808
|
+
}
|
|
6809
|
+
|
|
6810
|
+
@media only screen and (min-width: 32em) {
|
|
6811
|
+
|
|
6812
|
+
.RelatedBook-module_desktop__OZ9Jx {
|
|
6813
|
+
display: flex;
|
|
6814
|
+
}
|
|
6815
|
+
}
|
|
6816
|
+
|
|
6799
6817
|
.ListViewSwitcher-module_root__pBsR5 {
|
|
6800
6818
|
position: relative;
|
|
6801
6819
|
|
|
@@ -6908,6 +6926,97 @@ ul.VersesBlock-module_root__CrgSZ:first-child {
|
|
|
6908
6926
|
transform: translateX(16px);
|
|
6909
6927
|
}
|
|
6910
6928
|
|
|
6929
|
+
.RelatedCarousel-module_root__G-Eub {
|
|
6930
|
+
position: relative;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
.RelatedCarousel-module_track__UVQ2n {
|
|
6934
|
+
display: flex;
|
|
6935
|
+
gap: 20px;
|
|
6936
|
+
|
|
6937
|
+
margin: 0 -20px;
|
|
6938
|
+
padding: 0 20px;
|
|
6939
|
+
|
|
6940
|
+
overflow-x: auto;
|
|
6941
|
+
|
|
6942
|
+
list-style: none;
|
|
6943
|
+
overscroll-behavior-x: contain;
|
|
6944
|
+
|
|
6945
|
+
scroll-snap-type: x mandatory;
|
|
6946
|
+
scroll-padding-left: 20px;
|
|
6947
|
+
-webkit-overflow-scrolling: touch;
|
|
6948
|
+
|
|
6949
|
+
scrollbar-width: none;
|
|
6950
|
+
}
|
|
6951
|
+
|
|
6952
|
+
.RelatedCarousel-module_track__UVQ2n::-webkit-scrollbar {
|
|
6953
|
+
display: none;
|
|
6954
|
+
}
|
|
6955
|
+
|
|
6956
|
+
.RelatedCarousel-module_slide__MI9tF {
|
|
6957
|
+
position: relative;
|
|
6958
|
+
|
|
6959
|
+
flex: 0 0 85%;
|
|
6960
|
+
min-width: 0;
|
|
6961
|
+
|
|
6962
|
+
overflow: hidden;
|
|
6963
|
+
|
|
6964
|
+
scroll-snap-align: start;
|
|
6965
|
+
scroll-snap-stop: always;
|
|
6966
|
+
}
|
|
6967
|
+
|
|
6968
|
+
.RelatedCarousel-module_dots__mOSIC {
|
|
6969
|
+
--dotStep: 7px;
|
|
6970
|
+
|
|
6971
|
+
width: calc(var(--dotsVisible) * var(--dotStep));
|
|
6972
|
+
margin: 28px auto 0;
|
|
6973
|
+
|
|
6974
|
+
overflow: hidden;
|
|
6975
|
+
}
|
|
6976
|
+
|
|
6977
|
+
.RelatedCarousel-module_dotsTrack__V7bnX {
|
|
6978
|
+
display: flex;
|
|
6979
|
+
|
|
6980
|
+
transform: translateX(calc(var(--dotsStart) * var(--dotStep) * -1));
|
|
6981
|
+
|
|
6982
|
+
transition: transform 0.25s ease;
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6985
|
+
.RelatedCarousel-module_dotCell__kl64s {
|
|
6986
|
+
display: flex;
|
|
6987
|
+
flex: 0 0 auto;
|
|
6988
|
+
align-items: center;
|
|
6989
|
+
justify-content: center;
|
|
6990
|
+
|
|
6991
|
+
width: var(--dotStep);
|
|
6992
|
+
height: var(--dotStep);
|
|
6993
|
+
}
|
|
6994
|
+
|
|
6995
|
+
.RelatedCarousel-module_dot__Jo52r {
|
|
6996
|
+
width: 4px;
|
|
6997
|
+
height: 4px;
|
|
6998
|
+
|
|
6999
|
+
background-color: #d4d4d4;
|
|
7000
|
+
|
|
7001
|
+
border-radius: 50%;
|
|
7002
|
+
|
|
7003
|
+
transition: width 0.25s ease, height 0.25s ease, background-color 0.2s;
|
|
7004
|
+
}
|
|
7005
|
+
|
|
7006
|
+
.RelatedCarousel-module_isSmall__ZP5hd {
|
|
7007
|
+
width: 2px;
|
|
7008
|
+
height: 2px;
|
|
7009
|
+
}
|
|
7010
|
+
|
|
7011
|
+
.RelatedCarousel-module_isTiny__mjhtD {
|
|
7012
|
+
width: 1px;
|
|
7013
|
+
height: 1px;
|
|
7014
|
+
}
|
|
7015
|
+
|
|
7016
|
+
.RelatedCarousel-module_isActive__Nz2aj {
|
|
7017
|
+
background-color: #000;
|
|
7018
|
+
}
|
|
7019
|
+
|
|
6911
7020
|
.ToolbarButton-module_root__upsEH {
|
|
6912
7021
|
display: block;
|
|
6913
7022
|
|
package/package.json
CHANGED
package/src/Lazy/index.tsx
CHANGED
|
@@ -1,39 +1,26 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { useInView } from 'react-intersection-observer'
|
|
3
3
|
import { makeClassName } from '../utils/makeClassName'
|
|
4
4
|
import { LazyProps } from './Lazy.types'
|
|
5
5
|
|
|
6
6
|
import styles from './Lazy.module.css'
|
|
7
7
|
|
|
8
|
-
export const Lazy: React.FC<LazyProps> = ({ children, threshold }) => {
|
|
9
|
-
const [ref, inView
|
|
10
|
-
threshold: threshold
|
|
8
|
+
export const Lazy: React.FC<LazyProps> = ({ children, threshold = 0 }) => {
|
|
9
|
+
const [ref, inView] = useInView({
|
|
10
|
+
threshold: threshold,
|
|
11
|
+
triggerOnce: true
|
|
11
12
|
})
|
|
12
13
|
|
|
13
|
-
const [visible, setVisible] = useState(false)
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (entry && entry.boundingClientRect && entry.boundingClientRect.y < 0) {
|
|
17
|
-
setVisible(true)
|
|
18
|
-
}
|
|
19
|
-
}, [entry])
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (inView) {
|
|
23
|
-
setVisible(true)
|
|
24
|
-
}
|
|
25
|
-
}, [inView])
|
|
26
|
-
|
|
27
14
|
return (
|
|
28
15
|
<div
|
|
29
16
|
className={makeClassName([
|
|
30
17
|
[styles.root, true],
|
|
31
|
-
[styles.visible,
|
|
18
|
+
[styles.visible, inView]
|
|
32
19
|
])}
|
|
33
20
|
ref={ref}
|
|
34
21
|
data-testid="lazy"
|
|
35
22
|
>
|
|
36
|
-
{
|
|
23
|
+
{inView && children}
|
|
37
24
|
</div>
|
|
38
25
|
)
|
|
39
26
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
outline-width: 0;
|
|
17
17
|
background-color: #fff;
|
|
18
18
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
19
|
+
|
|
19
20
|
@media $portraitTablet {
|
|
20
21
|
margin: 25px 0;
|
|
21
22
|
}
|
|
@@ -206,3 +207,17 @@
|
|
|
206
207
|
--metaText: rgba(254, 255, 255, 0.5);
|
|
207
208
|
--metaFill: currentColor;
|
|
208
209
|
}
|
|
210
|
+
|
|
211
|
+
.mobile {
|
|
212
|
+
@media $mobile {
|
|
213
|
+
display: none;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.desktop {
|
|
218
|
+
display: none;
|
|
219
|
+
|
|
220
|
+
@media $mobile {
|
|
221
|
+
display: flex;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -14,13 +14,12 @@ export const RelatedBook: React.FC<RelatedBookProps> = ({
|
|
|
14
14
|
}) => {
|
|
15
15
|
const theme = block.data.theme.text_color === '0,0,0' ? 'isDark' : 'isLight'
|
|
16
16
|
|
|
17
|
+
const onlyOn = block.only_on || block.data.onlyOn
|
|
18
|
+
|
|
17
19
|
let classNames: ClassNames = [
|
|
18
20
|
[styles.root, true],
|
|
19
21
|
[styles[theme], theme],
|
|
20
|
-
[
|
|
21
|
-
styles[block.data.onlyOn],
|
|
22
|
-
!!block.data.onlyOn && !!styles[block.data.onlyOn]
|
|
23
|
-
]
|
|
22
|
+
[styles[onlyOn], !!onlyOn && !!styles[onlyOn]]
|
|
24
23
|
]
|
|
25
24
|
|
|
26
25
|
if (styleContext) {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.track {
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 20px;
|
|
8
|
+
|
|
9
|
+
margin: 0 -20px;
|
|
10
|
+
padding: 0 20px;
|
|
11
|
+
|
|
12
|
+
overflow-x: auto;
|
|
13
|
+
|
|
14
|
+
list-style: none;
|
|
15
|
+
overscroll-behavior-x: contain;
|
|
16
|
+
|
|
17
|
+
scroll-snap-type: x mandatory;
|
|
18
|
+
scroll-padding-left: 20px;
|
|
19
|
+
-webkit-overflow-scrolling: touch;
|
|
20
|
+
|
|
21
|
+
scrollbar-width: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.track::-webkit-scrollbar {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.slide {
|
|
29
|
+
position: relative;
|
|
30
|
+
|
|
31
|
+
flex: 0 0 85%;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
|
|
36
|
+
scroll-snap-align: start;
|
|
37
|
+
scroll-snap-stop: always;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dots {
|
|
41
|
+
--dotStep: 7px;
|
|
42
|
+
|
|
43
|
+
width: calc(var(--dotsVisible) * var(--dotStep));
|
|
44
|
+
margin: 28px auto 0;
|
|
45
|
+
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dotsTrack {
|
|
50
|
+
display: flex;
|
|
51
|
+
|
|
52
|
+
transform: translateX(calc(var(--dotsStart) * var(--dotStep) * -1));
|
|
53
|
+
|
|
54
|
+
transition: transform 0.25s ease;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dotCell {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex: 0 0 auto;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
|
|
63
|
+
width: var(--dotStep);
|
|
64
|
+
height: var(--dotStep);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dot {
|
|
68
|
+
width: 4px;
|
|
69
|
+
height: 4px;
|
|
70
|
+
|
|
71
|
+
background-color: #d4d4d4;
|
|
72
|
+
|
|
73
|
+
border-radius: 50%;
|
|
74
|
+
|
|
75
|
+
transition: width 0.25s ease, height 0.25s ease, background-color 0.2s;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.isSmall {
|
|
79
|
+
width: 2px;
|
|
80
|
+
height: 2px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.isTiny {
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 1px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.isActive {
|
|
89
|
+
background-color: #000;
|
|
90
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: block;
|
|
3
|
+
|
|
4
|
+
max-width: 375px;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
padding: 0 20px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.block {
|
|
10
|
+
margin: 16px -20px;
|
|
11
|
+
padding: 8px 20px 20px;
|
|
12
|
+
|
|
13
|
+
background-color: #f7f7f7;
|
|
14
|
+
border-top: 4px solid #b88b58;
|
|
15
|
+
|
|
16
|
+
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.header {
|
|
20
|
+
margin: 0 0 25px;
|
|
21
|
+
|
|
22
|
+
letter-spacing: 1px;
|
|
23
|
+
text-transform: uppercase;
|
|
24
|
+
|
|
25
|
+
color: #7f7f7f;
|
|
26
|
+
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
line-height: 17px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.card {
|
|
33
|
+
background-color: #fff;
|
|
34
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.cover {
|
|
38
|
+
display: block;
|
|
39
|
+
|
|
40
|
+
width: 100%;
|
|
41
|
+
aspect-ratio: 3 / 2;
|
|
42
|
+
|
|
43
|
+
background-color: #d5d5d5;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.title {
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 10px 12px 14px;
|
|
49
|
+
|
|
50
|
+
font-size: 18px;
|
|
51
|
+
font-weight: 700;
|
|
52
|
+
line-height: 130%;
|
|
53
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RelatedCarousel } from './'
|
|
3
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
|
|
5
|
+
import styles from './RelatedCarousel.stories.module.css'
|
|
6
|
+
import mock from './mock.json'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Main / RelatedCarousel',
|
|
10
|
+
component: RelatedCarousel,
|
|
11
|
+
parameters: {
|
|
12
|
+
themeWrapperSideBySide: true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface CardProps {
|
|
17
|
+
title: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Card: React.FC<CardProps> = ({ title }) => (
|
|
21
|
+
<div className={styles.card}>
|
|
22
|
+
<span className={styles.cover} />
|
|
23
|
+
<p className={styles.title}>{title}</p>
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const Example: React.FC = () => {
|
|
28
|
+
return (
|
|
29
|
+
<div className={styles.root}>
|
|
30
|
+
<div className={styles.block}>
|
|
31
|
+
<h3 className={styles.header}>{mock.title}</h3>
|
|
32
|
+
<RelatedCarousel ariaLabel={mock.title}>
|
|
33
|
+
{mock.related.map((item) => (
|
|
34
|
+
<Card key={item.id} title={item.title} />
|
|
35
|
+
))}
|
|
36
|
+
</RelatedCarousel>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Default: React.FC = () => (
|
|
43
|
+
<>
|
|
44
|
+
<PreviewWrapper theme="light">
|
|
45
|
+
<Example />
|
|
46
|
+
</PreviewWrapper>
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { RelatedCarousel } from './'
|
|
4
|
+
|
|
5
|
+
import styles from './RelatedCarousel.module.css'
|
|
6
|
+
|
|
7
|
+
describe('Related Carousel', () => {
|
|
8
|
+
const renderComponent = () =>
|
|
9
|
+
render(
|
|
10
|
+
<RelatedCarousel>
|
|
11
|
+
<div>Первая</div>
|
|
12
|
+
<div>Вторая</div>
|
|
13
|
+
</RelatedCarousel>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
it('should have root style', () => {
|
|
17
|
+
const { getByTestId } = renderComponent()
|
|
18
|
+
|
|
19
|
+
expect(getByTestId('related-carousel')).toHaveClass(styles.root)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('should render a dot per slide', () => {
|
|
23
|
+
const { getAllByRole } = renderComponent()
|
|
24
|
+
|
|
25
|
+
expect(getAllByRole('button')).toHaveLength(2)
|
|
26
|
+
})
|
|
27
|
+
})
|