@lynx-example/lynx-ui-swiper 0.0.1 → 0.0.3

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 (62) hide show
  1. package/Basic/index.tsx +109 -0
  2. package/Basic/styles.css +49 -0
  3. package/BasicDynamic/index.tsx +130 -0
  4. package/BasicDynamic/styles.css +47 -0
  5. package/BasicUpdateSize/index.tsx +131 -0
  6. package/BasicUpdateSize/styles.css +47 -0
  7. package/Bounces/index.tsx +73 -0
  8. package/Bounces/styles.css +41 -0
  9. package/CHANGELOG.md +15 -0
  10. package/Common/Button/index.tsx +48 -0
  11. package/Common/Button/styles.css +41 -0
  12. package/Common/Card/index.tsx +21 -0
  13. package/Common/Card/styles.css +21 -0
  14. package/Common/Indicator/index.tsx +24 -0
  15. package/Common/Indicator/styles.css +21 -0
  16. package/Custom/index.tsx +87 -0
  17. package/Custom/styles.css +47 -0
  18. package/CustomScale/index.tsx +116 -0
  19. package/CustomScale/styles.css +41 -0
  20. package/CustomTinder/Card.tsx +24 -0
  21. package/CustomTinder/index.tsx +111 -0
  22. package/CustomTinder/styles.css +61 -0
  23. package/DifferentHeight/Button.tsx +33 -0
  24. package/DifferentHeight/index.tsx +95 -0
  25. package/DifferentHeight/styles.css +50 -0
  26. package/Direction/index.tsx +127 -0
  27. package/Direction/styles.css +41 -0
  28. package/EmptyDataBug/index.tsx +371 -0
  29. package/EmptyDataBug/styles.css +75 -0
  30. package/Indicator/index.tsx +67 -0
  31. package/Indicator/styles.css +41 -0
  32. package/Lazy/index.tsx +83 -0
  33. package/Lazy/styles.css +41 -0
  34. package/Loop/index.tsx +77 -0
  35. package/Loop/styles.css +41 -0
  36. package/RTL/Button.tsx +33 -0
  37. package/RTL/index.tsx +133 -0
  38. package/RTL/styles.css +41 -0
  39. package/RTLCustom/index.tsx +115 -0
  40. package/RTLCustom/styles.css +41 -0
  41. package/RTLLoop/Button.tsx +33 -0
  42. package/RTLLoop/index.tsx +116 -0
  43. package/RTLLoop/styles.css +41 -0
  44. package/RTLLoopLynxRTL/Button.tsx +33 -0
  45. package/RTLLoopLynxRTL/index.tsx +116 -0
  46. package/RTLLoopLynxRTL/styles.css +41 -0
  47. package/WithGap/Button.tsx +33 -0
  48. package/WithGap/index.tsx +118 -0
  49. package/WithGap/styles.css +47 -0
  50. package/dist/SwiperBasic.lynx.bundle +0 -0
  51. package/dist/SwiperBasic.web.bundle +1 -1
  52. package/dist/SwiperBasicDynamic.lynx.bundle +0 -0
  53. package/dist/SwiperBasicDynamic.web.bundle +1 -1
  54. package/dist/SwiperBasicUpdateSize.lynx.bundle +0 -0
  55. package/dist/SwiperBasicUpdateSize.web.bundle +1 -1
  56. package/dist/SwiperCustomTinder.lynx.bundle +0 -0
  57. package/dist/SwiperCustomTinder.web.bundle +1 -1
  58. package/dist/SwiperDifferentHeight.lynx.bundle +0 -0
  59. package/dist/SwiperDifferentHeight.web.bundle +1 -1
  60. package/dist/SwiperEmptyDataBug.lynx.bundle +0 -0
  61. package/dist/SwiperEmptyDataBug.web.bundle +1 -1
  62. package/package.json +5 -3
@@ -0,0 +1,109 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { root, useRef, useState } from '@lynx-js/react'
6
+
7
+ import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
8
+ import type { SwiperRef } from '@lynx-js/lynx-ui'
9
+
10
+ import { Button } from '../Common/Button'
11
+ import { Card } from '../Common/Card'
12
+ import { Indicator } from '../Common/Indicator'
13
+
14
+ import './styles.css'
15
+
16
+ const itemArr: number[] = [1, 2, 3, 4, 5]
17
+
18
+ const itemWidths = [250, 350, 400]
19
+ const alignArr: ['start', 'center', 'end'] = ['start', 'center', 'end']
20
+
21
+ const INITIAL_INDEX = 2
22
+
23
+ function SwiperEntry(): JSX.Element {
24
+ const [itemWidthsIndex, setItemWidthsIndex] = useState<number>(0)
25
+ const [alignIndex, setAlignIndex] = useState<number>(1)
26
+ const [currentIndex, setCurrentIndex] = useState<number>(INITIAL_INDEX)
27
+ const swiperRef = useRef<SwiperRef>(null)
28
+
29
+ return (
30
+ <view className='demo-container lunaris-dark'>
31
+ <view className='top-area' />
32
+ <view className='content-area'>
33
+ <Swiper
34
+ ref={swiperRef}
35
+ data={itemArr}
36
+ itemWidth={itemWidths[itemWidthsIndex] ?? 0}
37
+ containerWidth={lynx.__globalProps.screenWidth - 32
38
+ || SystemInfo.pixelWidth / SystemInfo.pixelRatio - 32}
39
+ duration={500}
40
+ initialIndex={INITIAL_INDEX}
41
+ onChange={setCurrentIndex}
42
+ mode='normal'
43
+ modeConfig={{
44
+ align: alignArr[alignIndex],
45
+ spaceBetween: 16,
46
+ }}
47
+ autoPlay={false}
48
+ style={{
49
+ overflow: 'visible',
50
+ }}
51
+ >
52
+ {({ index, realIndex }) => (
53
+ <SwiperItem index={index} key={realIndex} realIndex={realIndex}>
54
+ <Card
55
+ index={realIndex}
56
+ style={{
57
+ height: '250px',
58
+ }}
59
+ />
60
+ </SwiperItem>
61
+ )}
62
+ </Swiper>
63
+ <Indicator
64
+ current={currentIndex}
65
+ count={itemArr.length}
66
+ />
67
+ </view>
68
+ <view className='operation'>
69
+ <Button
70
+ onClick={() => {
71
+ swiperRef.current?.swipePrev()
72
+ }}
73
+ className='expand'
74
+ text='SwipePrev'
75
+ />
76
+ <Button
77
+ onClick={() => {
78
+ swiperRef.current?.swipeNext()
79
+ }}
80
+ className='expand'
81
+ type='primary'
82
+ text='SwipeNext'
83
+ />
84
+ </view>
85
+ <view className='sub-operation'>
86
+ <Button
87
+ onClick={() => {
88
+ setItemWidthsIndex(prev => (prev + 1) % itemWidths.length)
89
+ }}
90
+ text={'Change Item Width'}
91
+ subText={`ItemWidth: ${itemWidths[itemWidthsIndex]}`}
92
+ >
93
+ </Button>
94
+ <Button
95
+ onClick={() => {
96
+ setAlignIndex(prev => (prev + 1) % itemWidths.length)
97
+ }}
98
+ text={'Change Align Type'}
99
+ subText={`AlignType: ${alignArr[alignIndex]}`}
100
+ >
101
+ </Button>
102
+ </view>
103
+ </view>
104
+ )
105
+ }
106
+
107
+ root.render(<SwiperEntry />)
108
+
109
+ export default SwiperEntry
@@ -0,0 +1,49 @@
1
+ @import "@lynx-js/luna-styles/index.css";
2
+
3
+ .demo-container {
4
+ background-color: var(--canvas);
5
+ display: flex;
6
+ width: 100%;
7
+ height: 100%;
8
+ flex-direction: column;
9
+ justify-content: center;
10
+ }
11
+
12
+ .expand {
13
+ flex: 1;
14
+ }
15
+
16
+ .top-area {
17
+ height: 54px;
18
+ width: 100%;
19
+ }
20
+
21
+ .content-area {
22
+ display: flex;
23
+ background: linear-gradient(
24
+ 0deg,
25
+ var(--gradient-a),
26
+ var(--gradient-b),
27
+ );
28
+ padding-top: 96px;
29
+ flex-direction: column;
30
+ justify-content: center;
31
+ align-items: center;
32
+ row-gap: 24px;
33
+ padding-bottom: 12px;
34
+ }
35
+
36
+ .operation {
37
+ display: flex;
38
+ flex-direction: row;
39
+ gap: 16px;
40
+ padding: 32px 16px;
41
+ }
42
+
43
+ .sub-operation {
44
+ display: flex;
45
+ flex: 1;
46
+ flex-direction: column;
47
+ gap: 8px;
48
+ padding: 0 16px 72px 16px;
49
+ }
@@ -0,0 +1,130 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { root, useEffect, useRef, useState } from '@lynx-js/react'
6
+
7
+ import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
8
+ import type { SwiperRef } from '@lynx-js/lynx-ui'
9
+
10
+ import './styles.css'
11
+
12
+ import { Button } from '../Common/Button'
13
+
14
+ const DEFAULT_COLORS_ARR: string[] = [
15
+ 'red',
16
+ 'green',
17
+ 'yellow',
18
+ 'purple',
19
+ 'lightgreen',
20
+ 'lightyellow',
21
+ 'lightblue',
22
+ 'gray',
23
+ ]
24
+
25
+ const itemWidths = [250, 350, 400]
26
+ const alignArr: ['start', 'center', 'end'] = ['start', 'center', 'end']
27
+
28
+ function SwiperEntry(): JSX.Element {
29
+ const [itemWidthsIndex, setItemWidthsIndex] = useState<number>(0)
30
+ const [alignIndex, setAlignIndex] = useState<number>(0)
31
+ const [currentIndex, setCurrentIndex] = useState<number>(0)
32
+ const swiperRef = useRef<SwiperRef>(null)
33
+ const [colorsArr, setColorsArr] = useState<string[]>([])
34
+
35
+ useEffect(() => {
36
+ setTimeout(() => {
37
+ setColorsArr(DEFAULT_COLORS_ARR.slice(0, 4))
38
+ }, 1000)
39
+ }, [])
40
+
41
+ return (
42
+ <view id='container'>
43
+ <Swiper
44
+ ref={swiperRef}
45
+ data={colorsArr}
46
+ itemWidth={itemWidths[itemWidthsIndex] ?? 0}
47
+ itemHeight={200}
48
+ duration={500}
49
+ initialIndex={0}
50
+ onChange={setCurrentIndex}
51
+ mode='normal'
52
+ loop={true}
53
+ autoPlay={true}
54
+ modeConfig={{
55
+ align: alignArr[alignIndex] ?? 'start',
56
+ }}
57
+ >
58
+ {({ item, index, realIndex }) => (
59
+ <SwiperItem index={index} key={realIndex} realIndex={realIndex}>
60
+ <view
61
+ class='block-view'
62
+ style={{
63
+ width: '100%',
64
+ height: '100%',
65
+ backgroundColor: item,
66
+ display: 'flex',
67
+ justifyContent: 'center',
68
+ alignItems: 'center',
69
+ }}
70
+ >
71
+ <view
72
+ style={{
73
+ backgroundColor: 'white',
74
+ width: '4px',
75
+ height: '4px',
76
+ }}
77
+ >
78
+ </view>
79
+ </view>
80
+ <text class='image-text'>Number.{index}</text>
81
+ </SwiperItem>
82
+ )}
83
+ </Swiper>
84
+ <view class='operation'>
85
+ <view class='block'>
86
+ <text>Current Index: {currentIndex}</text>
87
+ </view>
88
+ <Button
89
+ onClick={() => {
90
+ swiperRef.current?.swipePrev()
91
+ }}
92
+ text='SwipePrev'
93
+ >
94
+ </Button>
95
+ <Button
96
+ onClick={() => {
97
+ swiperRef.current?.swipeNext()
98
+ }}
99
+ text='SwipeNext'
100
+ >
101
+ </Button>
102
+ <Button
103
+ onClick={() => {
104
+ setItemWidthsIndex(prev => (prev + 1) % itemWidths.length)
105
+ }}
106
+ text={`itemWidth: ${itemWidths[itemWidthsIndex]}`}
107
+ >
108
+ </Button>
109
+ <Button
110
+ onClick={() => {
111
+ setAlignIndex(prev => (prev + 1) % itemWidths.length)
112
+ }}
113
+ text={`alignType: ${alignArr[alignIndex]}`}
114
+ >
115
+ </Button>
116
+ <Button
117
+ onClick={() => {
118
+ setColorsArr(prev => DEFAULT_COLORS_ARR.slice(0, prev.length + 1))
119
+ }}
120
+ text={`Add List Length, current: ${colorsArr.length}`}
121
+ >
122
+ </Button>
123
+ </view>
124
+ </view>
125
+ )
126
+ }
127
+
128
+ root.render(<SwiperEntry />)
129
+
130
+ export default SwiperEntry
@@ -0,0 +1,47 @@
1
+ .image {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .image-text {
7
+ position: absolute;
8
+ }
9
+
10
+ .container {
11
+ width: 100%;
12
+ height: 100%;
13
+ }
14
+
15
+ .title-container {
16
+ margin-top: 10px;
17
+ margin-bottom: 5px;
18
+ }
19
+
20
+ .title-text {
21
+ font-size: 16px;
22
+ }
23
+
24
+ .button {
25
+ border: 1px solid;
26
+ border-radius: 4px;
27
+ width: 150px;
28
+ background-color: red;
29
+ margin: 4px 8px;
30
+ padding: 4px 8px;
31
+ }
32
+
33
+ .button-text {
34
+ color: white;
35
+ }
36
+
37
+ .operation {
38
+ display: flex;
39
+ align-items: center;
40
+ flex-wrap: wrap;
41
+ }
42
+
43
+ .block {
44
+ display: flex;
45
+ width: 100%;
46
+ margin: 10px;
47
+ }
@@ -0,0 +1,131 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { root, useEffect, useRef, useState } from '@lynx-js/react'
6
+
7
+ import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
8
+ import type { SwiperRef } from '@lynx-js/lynx-ui'
9
+
10
+ import './styles.css'
11
+
12
+ import { Button } from '../Common/Button'
13
+
14
+ const DEFAULT_COLORS_ARR: string[] = [
15
+ 'red',
16
+ 'green',
17
+ 'yellow',
18
+ 'purple',
19
+ 'lightgreen',
20
+ 'lightyellow',
21
+ 'lightblue',
22
+ 'gray',
23
+ ]
24
+
25
+ const itemWidths = [250, 350, 400]
26
+ const alignArr: ['start', 'center', 'end'] = ['start', 'center', 'end']
27
+
28
+ function SwiperEntry(): JSX.Element {
29
+ const [itemWidthsIndex, setItemWidthsIndex] = useState<number>(0)
30
+ const [alignIndex, setAlignIndex] = useState<number>(0)
31
+ const [currentIndex, setCurrentIndex] = useState<number>(0)
32
+ const swiperRef = useRef<SwiperRef>(null)
33
+ const [colorsArr, setColorsArr] = useState<string[]>([])
34
+
35
+ useEffect(() => {
36
+ setTimeout(() => {
37
+ setColorsArr(DEFAULT_COLORS_ARR.slice(0, 4))
38
+ }, 1000)
39
+ }, [])
40
+
41
+ return (
42
+ <view id='container'>
43
+ <Swiper
44
+ ref={swiperRef}
45
+ data={colorsArr}
46
+ itemWidth={itemWidths[itemWidthsIndex] ?? 0}
47
+ containerWidth={itemWidths[itemWidthsIndex] ?? 0}
48
+ itemHeight={200}
49
+ duration={500}
50
+ initialIndex={0}
51
+ onChange={setCurrentIndex}
52
+ mode='normal'
53
+ loop={true}
54
+ autoPlay={false}
55
+ modeConfig={{
56
+ align: alignArr[alignIndex] ?? 'start',
57
+ }}
58
+ >
59
+ {({ item, index, realIndex }) => (
60
+ <SwiperItem index={index} key={realIndex} realIndex={realIndex}>
61
+ <view
62
+ class='block-view'
63
+ style={{
64
+ width: '100%',
65
+ height: '100%',
66
+ backgroundColor: item,
67
+ display: 'flex',
68
+ justifyContent: 'center',
69
+ alignItems: 'center',
70
+ }}
71
+ >
72
+ <view
73
+ style={{
74
+ backgroundColor: 'white',
75
+ width: '4px',
76
+ height: '4px',
77
+ }}
78
+ >
79
+ </view>
80
+ </view>
81
+ <text class='image-text'>Number.{index}</text>
82
+ </SwiperItem>
83
+ )}
84
+ </Swiper>
85
+ <view class='operation'>
86
+ <view class='block'>
87
+ <text>Current Index: {currentIndex}</text>
88
+ </view>
89
+ <Button
90
+ onClick={() => {
91
+ swiperRef.current?.swipePrev()
92
+ }}
93
+ text='SwipePrev'
94
+ >
95
+ </Button>
96
+ <Button
97
+ onClick={() => {
98
+ swiperRef.current?.swipeNext()
99
+ }}
100
+ text='SwipeNext'
101
+ >
102
+ </Button>
103
+ <Button
104
+ onClick={() => {
105
+ setItemWidthsIndex(prev => (prev + 1) % itemWidths.length)
106
+ }}
107
+ text={`itemWidth: ${itemWidths[itemWidthsIndex]}`}
108
+ >
109
+ </Button>
110
+ <Button
111
+ onClick={() => {
112
+ setAlignIndex(prev => (prev + 1) % itemWidths.length)
113
+ }}
114
+ text={`alignType: ${alignArr[alignIndex]}`}
115
+ >
116
+ </Button>
117
+ <Button
118
+ onClick={() => {
119
+ setColorsArr(prev => DEFAULT_COLORS_ARR.slice(0, prev.length + 1))
120
+ }}
121
+ text={`Add List Length, current: ${colorsArr.length}`}
122
+ >
123
+ </Button>
124
+ </view>
125
+ </view>
126
+ )
127
+ }
128
+
129
+ root.render(<SwiperEntry />)
130
+
131
+ export default SwiperEntry
@@ -0,0 +1,47 @@
1
+ .image {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .image-text {
7
+ position: absolute;
8
+ }
9
+
10
+ .container {
11
+ width: 100%;
12
+ height: 100%;
13
+ }
14
+
15
+ .title-container {
16
+ margin-top: 10px;
17
+ margin-bottom: 5px;
18
+ }
19
+
20
+ .title-text {
21
+ font-size: 16px;
22
+ }
23
+
24
+ .button {
25
+ border: 1px solid;
26
+ border-radius: 4px;
27
+ width: 150px;
28
+ background-color: red;
29
+ margin: 4px 8px;
30
+ padding: 4px 8px;
31
+ }
32
+
33
+ .button-text {
34
+ color: white;
35
+ }
36
+
37
+ .operation {
38
+ display: flex;
39
+ align-items: center;
40
+ flex-wrap: wrap;
41
+ }
42
+
43
+ .block {
44
+ display: flex;
45
+ width: 100%;
46
+ margin: 10px;
47
+ }
@@ -0,0 +1,73 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { root } from '@lynx-js/react'
6
+
7
+ import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
8
+
9
+ import './styles.css'
10
+
11
+ const colorsArr: string[] = ['red', 'green', 'yellow', 'purple']
12
+
13
+ function SwiperEntry() {
14
+ return (
15
+ <Swiper
16
+ data={colorsArr}
17
+ itemWidth={250}
18
+ loop={false}
19
+ duration={500}
20
+ initialIndex={0}
21
+ mode='normal'
22
+ modeConfig={{
23
+ align: 'start',
24
+ }}
25
+ bounceConfig={{
26
+ enable: true,
27
+ startBounceItemWidth: 0,
28
+ endBounceItemWidth: 100,
29
+ endBounceItem: (
30
+ <view style='display: linear; linear-orientation: vertical; height: 100%; width: 30px; border: 1px solid #000;'>
31
+ <text style='color: #000'>Show More</text>
32
+ </view>
33
+ ),
34
+ onEndBounceItemBounce: ({ type }) => {
35
+ console.log('onBounce result', type)
36
+ },
37
+ }}
38
+ onChange={(index) => {
39
+ console.log('onChange', index)
40
+ }}
41
+ >
42
+ {({ item, index, realIndex }) => (
43
+ <SwiperItem index={index} key={realIndex} realIndex={realIndex}>
44
+ <view
45
+ class='block-view'
46
+ style={{
47
+ width: '100%',
48
+ height: '100%',
49
+ backgroundColor: item,
50
+ display: 'flex',
51
+ justifyContent: 'center',
52
+ alignItems: 'center',
53
+ }}
54
+ >
55
+ <view
56
+ style={{
57
+ backgroundColor: 'white',
58
+ width: '4px',
59
+ height: '4px',
60
+ }}
61
+ >
62
+ </view>
63
+ </view>
64
+ <text class='image-text'>Number.{index}</text>
65
+ </SwiperItem>
66
+ )}
67
+ </Swiper>
68
+ )
69
+ }
70
+
71
+ root.render(<SwiperEntry />)
72
+
73
+ export default SwiperEntry
@@ -0,0 +1,41 @@
1
+ .image {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .image-text {
7
+ position: absolute;
8
+ }
9
+
10
+ .container {
11
+ width: 100%;
12
+ height: 100%;
13
+ }
14
+
15
+ .title-container {
16
+ margin-top: 10px;
17
+ margin-bottom: 5px;
18
+ }
19
+
20
+ .title-text {
21
+ font-size: 16px;
22
+ }
23
+
24
+ .button {
25
+ border: 1px solid;
26
+ border-radius: 4px;
27
+ width: 150px;
28
+ background-color: red;
29
+ margin: 4px 8px;
30
+ padding: 4px 8px;
31
+ }
32
+
33
+ .button-text {
34
+ color: white;
35
+ }
36
+
37
+ .operation {
38
+ display: flex;
39
+ align-items: center;
40
+ flex-wrap: wrap;
41
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @lynx-example/lynx-ui-swiper
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @lynx-js/lynx-ui@3.130.1
9
+
10
+ ## 0.0.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Include variant source files and shared directories in published packages ([#101](https://github.com/lynx-family/lynx-ui/pull/101))
15
+
16
+ - Adjust example styles to improve clarity in screen recordings. ([#102](https://github.com/lynx-family/lynx-ui/pull/102))
17
+
3
18
  ## 0.0.1
4
19
 
5
20
  ### Patch Changes
@@ -0,0 +1,48 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { Button as ButtonPrimitives } from '@lynx-js/lynx-ui'
6
+ import { clsx } from 'clsx'
7
+
8
+ import './styles.css'
9
+
10
+ export function Button({
11
+ type,
12
+ text,
13
+ subText,
14
+ onClick,
15
+ className,
16
+ }: {
17
+ className?: string
18
+ type?: 'primary' | 'secondary' | 'tertiary'
19
+ text?: string
20
+ subText?: string
21
+ onClick?: () => void
22
+ }) {
23
+ return (
24
+ <ButtonPrimitives
25
+ onClick={onClick}
26
+ className={clsx('button', className, type)}
27
+ >
28
+ {({ active = false }) => (
29
+ <view
30
+ className={clsx('button-inner', { 'button--active': active })}
31
+ >
32
+ <text
33
+ className={clsx('text', { 'text--active': active })}
34
+ >
35
+ {text}
36
+ </text>
37
+ {subText && (
38
+ <text
39
+ className={clsx('sub-text', { 'subText--active': active })}
40
+ >
41
+ {subText}
42
+ </text>
43
+ )}
44
+ </view>
45
+ )}
46
+ </ButtonPrimitives>
47
+ )
48
+ }