@tbox.cn/app-card-assets 0.0.0-stage → 0.1.1

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/SOURCE.md +5 -0
  4. package/assets.json +239 -0
  5. package/components/Banner/index.module.less +13 -0
  6. package/components/Banner/index.tsx +36 -0
  7. package/components/BlockAnimal/LottiePlayer/index.module.less +11 -0
  8. package/components/BlockAnimal/LottiePlayer/index.tsx +24 -0
  9. package/components/BlockAnimal/LottiePlayer/utils.ts +72 -0
  10. package/components/BlockAnimal/index.module.less +80 -0
  11. package/components/BlockAnimal/index.tsx +120 -0
  12. package/components/BlockBarrage/index.module.less +104 -0
  13. package/components/BlockBarrage/index.tsx +98 -0
  14. package/components/BlockFanSwiper/index.module.less +93 -0
  15. package/components/BlockFanSwiper/index.tsx +56 -0
  16. package/components/BlockIntro/index.module.less +32 -0
  17. package/components/BlockIntro/index.tsx +21 -0
  18. package/components/BlockIntroCenter/index.module.less +31 -0
  19. package/components/BlockIntroCenter/index.tsx +22 -0
  20. package/components/BlockNowList/index.module.less +75 -0
  21. package/components/BlockNowList/index.tsx +54 -0
  22. package/components/BlockQuestionList/index.module.less +115 -0
  23. package/components/BlockQuestionList/index.tsx +107 -0
  24. package/components/BlockServiceIconList/index.module.less +68 -0
  25. package/components/BlockServiceIconList/index.tsx +83 -0
  26. package/components/BlockServiceList/index.module.less +92 -0
  27. package/components/BlockServiceList/index.tsx +88 -0
  28. package/components/BlockTravelCarousel/index.module.less +127 -0
  29. package/components/BlockTravelCarousel/index.tsx +101 -0
  30. package/components/BlockTravelCarousel/tags/Tags.module.less +20 -0
  31. package/components/BlockTravelCarousel/tags/Tags.tsx +20 -0
  32. package/components/OneCol/index.module.less +161 -0
  33. package/components/OneCol/index.tsx +83 -0
  34. package/components/TwoCol/index.module.less +199 -0
  35. package/components/TwoCol/index.tsx +82 -0
  36. package/docs/Banner.md +17 -0
  37. package/docs/BlockAnimal.md +17 -0
  38. package/docs/BlockBarrage.md +17 -0
  39. package/docs/BlockFanSwiper.md +17 -0
  40. package/docs/BlockIntro.md +17 -0
  41. package/docs/BlockIntroCenter.md +17 -0
  42. package/docs/BlockNowList.md +17 -0
  43. package/docs/BlockQuestionList.md +17 -0
  44. package/docs/BlockServiceIconList.md +17 -0
  45. package/docs/BlockServiceList.md +17 -0
  46. package/docs/BlockTravelCarousel.md +17 -0
  47. package/docs/OneCol.md +17 -0
  48. package/docs/TwoCol.md +17 -0
  49. package/examples/Banner.json +5 -0
  50. package/examples/BlockAnimal.json +22 -0
  51. package/examples/BlockBarrage.json +26 -0
  52. package/examples/BlockFanSwiper.json +23 -0
  53. package/examples/BlockIntro.json +4 -0
  54. package/examples/BlockIntroCenter.json +4 -0
  55. package/examples/BlockNowList.json +36 -0
  56. package/examples/BlockQuestionList.json +25 -0
  57. package/examples/BlockServiceIconList.json +36 -0
  58. package/examples/BlockServiceList.json +36 -0
  59. package/examples/BlockTravelCarousel.json +37 -0
  60. package/examples/OneCol.json +49 -0
  61. package/examples/TwoCol.json +49 -0
  62. package/package.json +39 -3
  63. package/shared/actions.ts +38 -0
  64. package/shared/home-integration.md +49 -0
  65. package/shared/types.ts +10 -0
@@ -0,0 +1,107 @@
1
+ import type { CardAssetProps as ICardProps } from '../../shared/types';
2
+ import React, { useState, useEffect } from 'react';
3
+ import styles from './index.module.less';
4
+
5
+ interface ArticleListProps extends ICardProps {
6
+ /** 后端下发的卡片渲染相关的所有字段 */
7
+ cardData: {
8
+ title?: string;
9
+ list?: Array<{
10
+ content?: string;
11
+ query?: string;
12
+ }>;
13
+ defaultNum?: number;
14
+ } & ICardProps['cardData'];
15
+ }
16
+
17
+ const EMPTY_LIST: NonNullable<ArticleListProps['cardData']['list']> = [];
18
+
19
+ interface ArticleItemProps {
20
+ content?: string;
21
+ onClick?: () => void;
22
+ index?: number;
23
+ }
24
+
25
+ const ArticleItem: React.FC<ArticleItemProps> = ({ content, onClick, index = 0 }) => {
26
+ return (
27
+ <div
28
+ className={styles.articleItem}
29
+ style={{
30
+ marginTop: index === 0 ? '0.0rem' : '0.16rem',
31
+ }}
32
+ onClick={onClick}
33
+ >
34
+ <img
35
+ src="https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*WkE1Rasmfk4AAAAAAAAAAAAAet-KAQ/original"
36
+ className={styles.itemThumbnail}
37
+ alt="thumbnail"
38
+ />
39
+ <span className={styles.itemDescription}>{content}</span>
40
+ <img
41
+ src="https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*-4_2QZGFzLsAAAAAAAAAAAAAet-KAQ/original"
42
+ className={styles.navigationIcon}
43
+ alt="navigation"
44
+ />
45
+ </div>
46
+ );
47
+ };
48
+
49
+ const ArticleList: React.FC<ArticleListProps> = ({ cardData = {}, bridgeAPI }) => {
50
+ const { title, list = EMPTY_LIST, defaultNum = 4 } = cardData;
51
+ const [displayedList, setDisplayedList] = useState<Array<{ content?: string; query?: string }>>([]);
52
+ const [currentPage, setCurrentPage] = useState(0);
53
+ const pageSize = Number.isFinite(defaultNum) ? Math.max(1, Math.floor(defaultNum)) : 4;
54
+
55
+ const formatData = () => {
56
+ if (!list || list.length === 0) { setDisplayedList([]); return; }
57
+
58
+ const displayedItems: Array<{ content?: string; query?: string }> = [];
59
+ for (let i = 0; i < Math.min(pageSize, list.length); i++) {
60
+ const index = (currentPage + i) % list.length;
61
+ displayedItems.push(list[index]);
62
+ }
63
+
64
+ setDisplayedList(displayedItems);
65
+ };
66
+
67
+ useEffect(() => {
68
+ formatData();
69
+ }, [currentPage, list, pageSize]);
70
+
71
+ const handleRefresh = () => {
72
+ if (list.length) setCurrentPage((prevPage) => (prevPage + pageSize) % list.length);
73
+ };
74
+
75
+ const handleItemClick = (item: any) => {
76
+ if (item?.query) {
77
+ bridgeAPI?.sendQuery({
78
+ question_content: item.query,
79
+ });
80
+ }
81
+ };
82
+
83
+ return (
84
+ <div className={styles.articleList}>
85
+ <div className={styles.headerSection}>
86
+ <div className={styles.titleWrapper}>
87
+ <span className={styles.articleTitle}>{title}</span>
88
+ <div className={styles.actionBar} onClick={handleRefresh}>
89
+ <img
90
+ src="https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*kDzsRblLTOYAAAAAAAAAAAAAet-KAQ/original"
91
+ className={styles.loadingIndicator}
92
+ alt="refresh"
93
+ />
94
+ <span className={styles.refreshButton}>换一换</span>
95
+ </div>
96
+ </div>
97
+ <div className={styles.contentArea}>
98
+ {displayedList.map((item, index) => (
99
+ <ArticleItem key={index} content={item.content} onClick={() => handleItemClick(item)} index={index} />
100
+ ))}
101
+ </div>
102
+ </div>
103
+ </div>
104
+ );
105
+ };
106
+
107
+ export default ArticleList;
@@ -0,0 +1,68 @@
1
+ .serviceList {
2
+ width: 100%;
3
+ min-width: 0;
4
+ margin-bottom: 28px;
5
+ border-radius: 24px;
6
+ background-color: rgba(255, 255, 255, 0.5);
7
+ padding: 24px;
8
+ display: flex;
9
+ flex-direction: column;
10
+ justify-content: center;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ .servers {
15
+ display: flex;
16
+ flex-direction: column;
17
+ }
18
+ .serversTitle {
19
+ color: #1f3b63;
20
+ font-size: 30px;
21
+ font-weight: 500;
22
+ }
23
+
24
+ .serversListBox {
25
+ margin-top: 24px;
26
+ width: 100%;
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ }
31
+
32
+ .serversList {
33
+ display: grid;
34
+ grid-template-columns: repeat(4, minmax(0, 1fr));
35
+ width: 100%;
36
+ min-width: 0;
37
+ }
38
+
39
+ .serversItem {
40
+ display: flex;
41
+ justify-content: center;
42
+ align-items: center;
43
+ min-width: 0;
44
+ height: 86px;
45
+ cursor: pointer;
46
+ }
47
+ .serversItemBox {
48
+ max-width: 100%;
49
+ min-width: 0;
50
+ display: flex;
51
+ flex-direction: column;
52
+ justify-content: center;
53
+ align-items: center;
54
+ }
55
+
56
+ .serversIcon {
57
+ width: 48px;
58
+ height: 48px;
59
+ }
60
+
61
+ .serversText {
62
+ font-size: 22px;
63
+ color: #1f3b63;
64
+ margin-top: 8px;
65
+ text-align: center;
66
+ max-width: 100%;
67
+ overflow-wrap: anywhere;
68
+ }
@@ -0,0 +1,83 @@
1
+ import { runCardClick } from '../../shared/actions';
2
+ import type { CardAssetProps as ICardProps } from '../../shared/types';
3
+ import React from 'react';
4
+ import styles from './index.module.less';
5
+ import { PictureWrongOutline } from 'antd-mobile-icons';
6
+
7
+ interface BlockServiceIconListProps extends ICardProps {
8
+ /** 后端下发的卡片渲染相关的所有字段 */
9
+ cardData: {
10
+ title?: string;
11
+ list?: Array<{
12
+ icon?: string;
13
+ title?: string;
14
+ clickAction?: string;
15
+ query?: string;
16
+ jumpUrl?: string;
17
+ }>;
18
+ } & ICardProps['cardData'];
19
+ }
20
+
21
+ interface ServiceItemProps {
22
+ icon?: string;
23
+ title?: string;
24
+ onClick?: () => void;
25
+ index?: number;
26
+ }
27
+
28
+ const ServiceItem: React.FC<ServiceItemProps> = ({ icon, title, onClick, index = 0 }) => {
29
+ return (
30
+ <div
31
+ className={styles.serversItem}
32
+ style={{
33
+ marginTop: index > 3 ? '0.28rem' : 0,
34
+ }}
35
+ onClick={onClick}
36
+ >
37
+ <div className={styles.serversItemBox}>
38
+ {icon ? (
39
+ <img className={styles.serversIcon} src={icon} alt={title} />
40
+ ) : (
41
+ <PictureWrongOutline
42
+ style={{
43
+ color: '#333',
44
+ fontSize: '0.24rem',
45
+ }}
46
+ className={styles.serversIcon}
47
+ />
48
+ )}
49
+ <span className={styles.serversText}>{title}</span>
50
+ </div>
51
+ </div>
52
+ );
53
+ };
54
+
55
+ const BlockServiceIconList: React.FC<BlockServiceIconListProps> = ({ cardData = {}, bridgeAPI }) => {
56
+ const { title, list = [] } = cardData;
57
+ const serviceList = list.slice(0, 8);
58
+
59
+ const handleServiceClick = (item: any) => runCardClick(bridgeAPI, item);
60
+
61
+ return (
62
+ <div className={styles.serviceList}>
63
+ <div className={styles.servers}>
64
+ <span className={styles.serversTitle}>{title}</span>
65
+ <div className={styles.serversListBox}>
66
+ <div className={styles.serversList}>
67
+ {serviceList.map((item, index) => (
68
+ <ServiceItem
69
+ key={index}
70
+ icon={item.icon}
71
+ title={item.title}
72
+ onClick={() => handleServiceClick(item)}
73
+ index={index}
74
+ />
75
+ ))}
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ );
81
+ };
82
+
83
+ export default BlockServiceIconList;
@@ -0,0 +1,92 @@
1
+ .travelType {
2
+ width: 100%;
3
+ min-width: 0;
4
+ box-sizing: border-box;
5
+ margin-bottom: 28px;
6
+ }
7
+
8
+ .serviceHeader {
9
+ border-radius: 24px;
10
+ background-color: rgba(255, 255, 255, 0.5);
11
+ padding: 0 24px 28px;
12
+ display: flex;
13
+ flex-direction: column;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ .mainTitle {
18
+ font-size: 30px;
19
+ color: #1f3b63;
20
+ line-height: 40px;
21
+ font-weight: 500;
22
+ margin: 24px 0;
23
+ }
24
+
25
+ .transportOptions {
26
+ width: 100%;
27
+ display: flex;
28
+ height: 164px;
29
+ flex-direction: row;
30
+ overflow-x: auto;
31
+ gap: 12px;
32
+ // 隐藏滚动条width: 0;
33
+ scrollbar-width: none;
34
+ }
35
+ .optionsContainer {
36
+ position: relative;
37
+ width: 280px;
38
+ max-width: 100%;
39
+ height: 164px;
40
+ padding: 20px 24px;
41
+ display: flex;
42
+ flex-direction: column;
43
+ align-items: flex-start;
44
+ justify-content: space-between;
45
+ background-size: cover;
46
+ box-sizing: border-box;
47
+ flex-shrink: 0;
48
+ flex-grow: 0;
49
+ border-radius: 16px;
50
+ overflow: hidden;
51
+ }
52
+
53
+ .optionsMark {
54
+ position: absolute;
55
+ top: 0;
56
+ left: 0;
57
+ width: 100%;
58
+ height: 100%;
59
+ }
60
+ .optionsMarkWrap {
61
+ position: relative;
62
+ width: 100%;
63
+ height: 100%;
64
+ z-index: 1;
65
+ }
66
+
67
+ .guideTitle {
68
+ color: rgb(255, 255, 255);
69
+ font-size: 26px;
70
+ white-space: nowrap;
71
+ box-sizing: border-box;
72
+ margin-bottom: 30px;
73
+ overflow: hidden;
74
+ text-overflow: ellipsis;
75
+ width: 100%;
76
+ }
77
+
78
+ .descWrap {
79
+ display: flex;
80
+ flex-direction: column;
81
+ }
82
+
83
+ .freeTourOption {
84
+ margin-bottom: 12px;
85
+ color: rgb(237, 238, 239);
86
+ font-size: 22px;
87
+ box-sizing: border-box;
88
+ white-space: nowrap;
89
+ overflow: hidden;
90
+ text-overflow: ellipsis;
91
+ width: 100%;
92
+ }
@@ -0,0 +1,88 @@
1
+ import { runCardClick } from '../../shared/actions';
2
+ import type { CardAssetProps as ICardProps } from '../../shared/types';
3
+ import React from 'react';
4
+ import styles from './index.module.less';
5
+
6
+ interface BlockServiceListProps extends ICardProps {
7
+ /** 后端下发的卡片渲染相关的所有字段 */
8
+ cardData: {
9
+ title?: string;
10
+ list?: Array<{
11
+ imageUrl?: string;
12
+ title?: string;
13
+ clickAction?: string;
14
+ tags?: string[];
15
+ jumpUrl?: string;
16
+ query?: string;
17
+ }>;
18
+ } & ICardProps['cardData'];
19
+ }
20
+
21
+ interface ScenicCardProps {
22
+ imageUrl?: string;
23
+ title?: string;
24
+ tags?: string[];
25
+ onClick?: () => void;
26
+ index?: number;
27
+ }
28
+
29
+ const ScenicCard: React.FC<ScenicCardProps> = ({ imageUrl, title, tags = [], onClick, index = 0 }) => {
30
+ const showMaskFlag = tags?.length > 0 || title;
31
+
32
+ return (
33
+ <div
34
+ className={styles.optionsContainer}
35
+ style={{
36
+ backgroundImage: `url(${imageUrl})`,
37
+ marginLeft: index > 0 ? '0.12rem' : '0',
38
+ }}
39
+ onClick={onClick}
40
+ >
41
+ {showMaskFlag && (
42
+ <img
43
+ src="https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*EngjSaAIWqgAAAAAAAAAAAAAet-KAQ/original"
44
+ className={styles.optionsMark}
45
+ alt="mask"
46
+ />
47
+ )}
48
+ <div className={styles.optionsMarkWrap}>
49
+ <div className={styles.guideTitle}>{title}</div>
50
+ <div className={styles.descWrap}>
51
+ {tags.map((tag, tagIndex) => (
52
+ <div key={tagIndex} className={styles.freeTourOption}>
53
+ {tag}
54
+ </div>
55
+ ))}
56
+ </div>
57
+ </div>
58
+ </div>
59
+ );
60
+ };
61
+
62
+ const BlockServiceList: React.FC<BlockServiceListProps> = ({ cardData = {}, bridgeAPI }) => {
63
+ const { title, list = [] } = cardData;
64
+
65
+ const handleItemClick = (item: any) => runCardClick(bridgeAPI, item);
66
+
67
+ return (
68
+ <div className={styles.travelType}>
69
+ <div className={styles.serviceHeader}>
70
+ <span className={styles.mainTitle}>{title}</span>
71
+ <div className={styles.transportOptions}>
72
+ {list.map((item, index) => (
73
+ <ScenicCard
74
+ key={index}
75
+ imageUrl={item.imageUrl}
76
+ title={item.title}
77
+ tags={item.tags}
78
+ onClick={() => handleItemClick(item)}
79
+ index={index}
80
+ />
81
+ ))}
82
+ </div>
83
+ </div>
84
+ </div>
85
+ );
86
+ };
87
+
88
+ export default BlockServiceList;
@@ -0,0 +1,127 @@
1
+ .escortList {
2
+ width: 100%;
3
+ min-width: 0;
4
+ box-sizing: border-box;
5
+ position: relative;
6
+ border-radius: 24px;
7
+ height: 448px;
8
+ margin-bottom: 28px;
9
+ line-height: 1.5;
10
+ }
11
+
12
+ .swiper {
13
+ border-radius: 24px;
14
+ height: 448px;
15
+ }
16
+
17
+ .infoCard {
18
+ height: 448px;
19
+ width: 100%;
20
+ box-sizing: border-box;
21
+ position: relative;
22
+ background-position: center;
23
+ background-size: cover;
24
+ background-repeat: no-repeat;
25
+ }
26
+
27
+ .escortMark {
28
+ position: absolute;
29
+ top: 224px;
30
+ left: 0;
31
+ height: 224px;
32
+ width: 100%;
33
+ border-radius: 0 0 24px 24px;
34
+ background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
35
+ }
36
+
37
+ .titleTag {
38
+ position: absolute;
39
+ top: 24px;
40
+ left: 24px;
41
+ box-sizing: border-box;
42
+ border-radius: 8px;
43
+ padding: 0 10px;
44
+ font-size: 22px;
45
+ color: #fff;
46
+ text-align: center;
47
+ font-weight: 500;
48
+ background-image: linear-gradient(90deg, #fe5500 0%, #ff8e00 100%);
49
+ }
50
+
51
+ .infoBox {
52
+ position: absolute;
53
+ padding: 0 24px;
54
+ bottom: 32px;
55
+ width: 100%;
56
+ }
57
+
58
+ .infoContainer {
59
+ display: flex;
60
+ align-items: center;
61
+ box-sizing: border-box;
62
+ flex-direction: row;
63
+ }
64
+
65
+ .titleText {
66
+ color: rgb(255, 255, 255);
67
+ font-size: 40px;
68
+ font-weight: 500;
69
+ line-height: 48px;
70
+ white-space: nowrap;
71
+ box-sizing: border-box;
72
+ margin-bottom: 12px;
73
+ }
74
+
75
+ .infoDesc {
76
+ font-size: 24px;
77
+ color: #fff;
78
+ letter-spacing: 1px;
79
+ font-weight: 500;
80
+ opacity: 0.7;
81
+ text-overflow: ellipsis;
82
+ margin-top: 16px;
83
+ line-height: 32px;
84
+ }
85
+
86
+ .dotsBox {
87
+ position: absolute;
88
+ bottom: 12px;
89
+ left: 0;
90
+ width: 100%;
91
+ display: flex;
92
+ justify-content: center;
93
+ align-items: center;
94
+ }
95
+
96
+ .dotsBox2 {
97
+ position: absolute;
98
+ bottom: 32px;
99
+ right: 24px;
100
+ }
101
+
102
+ .customDots {
103
+ display: flex;
104
+ justify-content: center;
105
+ flex-direction: row;
106
+ }
107
+
108
+ .indicatorDot {
109
+ width: 8px;
110
+ height: 8px;
111
+ border-radius: 4px;
112
+ background-color: rgba(255, 255, 255, 0.4);
113
+ margin: 0 4px;
114
+ }
115
+
116
+ .active {
117
+ background-color: #fff;
118
+ width: 23px;
119
+ }
120
+
121
+ .tagsBox1 {
122
+ margin-left: 16px;
123
+ }
124
+
125
+ .tagsBox2 {
126
+ margin-top: 12px;
127
+ }
@@ -0,0 +1,101 @@
1
+ import { runCardClick } from '../../shared/actions';
2
+ import type { CardAssetProps as ICardProps } from '../../shared/types';
3
+ import React, { useState } from 'react';
4
+ import { Swiper } from 'antd-mobile';
5
+ import styles from './index.module.less';
6
+ import Tags from './tags/Tags';
7
+
8
+ interface BlockTravelCarouselProps extends ICardProps {
9
+ /** 后端下发的卡片渲染相关的所有字段 */
10
+ cardData: {
11
+ title?: string;
12
+ hotTitle?: string;
13
+ list?: Array<{
14
+ imageUrl?: string;
15
+ title?: string;
16
+ desc?: string;
17
+ tags?: string[];
18
+ clickAction?: string;
19
+ jumpUrl?: string;
20
+ query?: string;
21
+ }>;
22
+ } & ICardProps['cardData'];
23
+ }
24
+
25
+ interface CarouselItemProps {
26
+ item: any;
27
+ hotTitle?: string;
28
+ hasDesc: boolean;
29
+ onClick: () => void;
30
+ }
31
+
32
+ const CarouselItem: React.FC<CarouselItemProps> = ({ item, hotTitle, hasDesc, onClick }) => {
33
+ return (
34
+ <div
35
+ className={styles.infoCard}
36
+ style={{
37
+ backgroundImage: `url(${item.imageUrl})`,
38
+ }}
39
+ onClick={onClick}
40
+ >
41
+ <div className={styles.escortMark} />
42
+ <span className={styles.titleTag}>{hotTitle}</span>
43
+ <div className={styles.infoBox}>
44
+ <div className={styles.infoContainer}>
45
+ <span className={styles.titleText}>{item.title}</span>
46
+ {hasDesc && item.tags && (
47
+ <div className={styles.tagsBox1}>
48
+ <Tags tags={item.tags} />
49
+ </div>
50
+ )}
51
+ </div>
52
+ {!hasDesc && item.tags && (
53
+ <div className={styles.tagsBox2}>
54
+ <Tags tags={item.tags} />
55
+ </div>
56
+ )}
57
+ {hasDesc && item.desc && <span className={styles.infoDesc}>{item.desc}</span>}
58
+ </div>
59
+ </div>
60
+ );
61
+ };
62
+
63
+ const BlockTravelCarousel: React.FC<BlockTravelCarouselProps> = ({ cardData = {}, bridgeAPI }) => {
64
+ const { hotTitle, list = [] } = cardData;
65
+ const [currentIndex, setCurrentIndex] = useState(0);
66
+ const hasDesc = !!list[0]?.desc;
67
+
68
+ const handleClick = (item: any) => runCardClick(bridgeAPI, item);
69
+
70
+ if (!list.length) return null;
71
+
72
+ const dotsBoxClass = hasDesc ? styles.dotsBox : styles.dotsBox2;
73
+
74
+ return (
75
+ <div className={styles.escortList}>
76
+ <Swiper
77
+ className={styles.swiper}
78
+ autoplay={list.length > 1}
79
+ autoplayInterval={3000}
80
+ onIndexChange={setCurrentIndex}
81
+ loop={list.length > 1}
82
+ indicator={false}
83
+ >
84
+ {list.map((item, index) => (
85
+ <Swiper.Item key={index}>
86
+ <CarouselItem item={item} hotTitle={hotTitle} hasDesc={hasDesc} onClick={() => handleClick(item)} />
87
+ </Swiper.Item>
88
+ ))}
89
+ </Swiper>
90
+ <div className={dotsBoxClass}>
91
+ <div className={styles.customDots}>
92
+ {list.map((_, index) => (
93
+ <div key={index} className={`${styles.indicatorDot} ${currentIndex === index ? styles.active : ''}`} />
94
+ ))}
95
+ </div>
96
+ </div>
97
+ </div>
98
+ );
99
+ };
100
+
101
+ export default BlockTravelCarousel;
@@ -0,0 +1,20 @@
1
+ .buttonGroup {
2
+ display: flex;
3
+ flex-direction: row;
4
+ box-sizing: border-box;
5
+ }
6
+ .button {
7
+ margin-right: 12px;
8
+ padding: 0 12px;
9
+ display: flex;
10
+ align-items: center;
11
+ flex-direction: row;
12
+ justify-content: center;
13
+ height: 38px;
14
+ background-color: rgba(255, 255, 255, 0.14);
15
+ font-size: 24px;
16
+ color: #fff;
17
+ border: 1.5px solid #6c6e7e;
18
+ border-radius: 19px;
19
+ box-sizing: border-box;
20
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import styles from './Tags.module.less';
3
+
4
+ interface TagsProps {
5
+ tags?: string[];
6
+ }
7
+
8
+ const Tags: React.FC<TagsProps> = ({ tags = [] }) => {
9
+ return (
10
+ <div className={styles.buttonGroup}>
11
+ {tags.map((tag, index) => (
12
+ <span key={index} className={styles.button}>
13
+ {tag}
14
+ </span>
15
+ ))}
16
+ </div>
17
+ );
18
+ };
19
+
20
+ export default Tags;