@coinbase/cds-mobile 8.41.0 → 8.42.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/CHANGELOG.md +11 -0
- package/dts/alpha/data-card/DataCard.d.ts +27 -0
- package/dts/alpha/data-card/DataCard.d.ts.map +1 -0
- package/dts/alpha/data-card/DataCardLayout.d.ts +38 -0
- package/dts/alpha/data-card/DataCardLayout.d.ts.map +1 -0
- package/dts/alpha/data-card/__figma__/DataCard.figma.d.ts +2 -0
- package/dts/alpha/data-card/__figma__/DataCard.figma.d.ts.map +1 -0
- package/dts/alpha/data-card/index.d.ts +3 -0
- package/dts/alpha/data-card/index.d.ts.map +1 -0
- package/dts/alpha/index.d.ts +1 -0
- package/dts/alpha/index.d.ts.map +1 -1
- package/dts/cards/AnnouncementCard.d.ts +2 -2
- package/dts/cards/AnnouncementCard.d.ts.map +1 -1
- package/dts/cards/CardMedia.d.ts +1 -2
- package/dts/cards/CardMedia.d.ts.map +1 -1
- package/dts/cards/CardRoot.d.ts +32 -0
- package/dts/cards/CardRoot.d.ts.map +1 -0
- package/dts/cards/ContainedAssetCard.d.ts +27 -0
- package/dts/cards/ContainedAssetCard.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCard.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardBody.d.ts +82 -10
- package/dts/cards/ContentCard/ContentCardBody.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardFooter.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardHeader.d.ts +50 -12
- package/dts/cards/ContentCard/ContentCardHeader.d.ts.map +1 -1
- package/dts/cards/DataCard.d.ts.map +1 -1
- package/dts/cards/FeatureEntryCard.d.ts +2 -2
- package/dts/cards/FeatureEntryCard.d.ts.map +1 -1
- package/dts/cards/FeedCard.d.ts +3 -0
- package/dts/cards/FeedCard.d.ts.map +1 -1
- package/dts/cards/FloatingAssetCard.d.ts +25 -0
- package/dts/cards/FloatingAssetCard.d.ts.map +1 -1
- package/dts/cards/MediaCard/MediaCardLayout.d.ts +40 -0
- package/dts/cards/MediaCard/MediaCardLayout.d.ts.map +1 -0
- package/dts/cards/MediaCard/__figma__/MediaCard.figma.d.ts +2 -0
- package/dts/cards/MediaCard/__figma__/MediaCard.figma.d.ts.map +1 -0
- package/dts/cards/MediaCard/index.d.ts +28 -0
- package/dts/cards/MediaCard/index.d.ts.map +1 -0
- package/dts/cards/MessagingCard/MessagingCardLayout.d.ts +62 -0
- package/dts/cards/MessagingCard/MessagingCardLayout.d.ts.map +1 -0
- package/dts/cards/MessagingCard/__figma__/MessagingCard.figma.d.ts +2 -0
- package/dts/cards/MessagingCard/__figma__/MessagingCard.figma.d.ts.map +1 -0
- package/dts/cards/MessagingCard/index.d.ts +21 -0
- package/dts/cards/MessagingCard/index.d.ts.map +1 -0
- package/dts/cards/NudgeCard.d.ts +27 -0
- package/dts/cards/NudgeCard.d.ts.map +1 -1
- package/dts/cards/UpsellCard.d.ts +27 -0
- package/dts/cards/UpsellCard.d.ts.map +1 -1
- package/dts/cards/index.d.ts +4 -0
- package/dts/cards/index.d.ts.map +1 -1
- package/dts/examples/ExampleScreen.d.ts.map +1 -1
- package/esm/alpha/data-card/DataCard.js +44 -0
- package/esm/alpha/data-card/DataCardLayout.js +80 -0
- package/esm/alpha/data-card/__figma__/DataCard.figma.js +29 -0
- package/esm/alpha/data-card/__stories__/DataCard.stories.js +367 -0
- package/esm/alpha/data-card/index.js +1 -0
- package/esm/alpha/index.js +1 -0
- package/esm/cards/AnnouncementCard.js +2 -2
- package/esm/cards/CardMedia.js +5 -4
- package/esm/cards/CardRoot.js +27 -0
- package/esm/cards/ContainedAssetCard.js +27 -0
- package/esm/cards/ContentCard/ContentCard.js +7 -6
- package/esm/cards/ContentCard/ContentCardBody.js +74 -19
- package/esm/cards/ContentCard/ContentCardFooter.js +4 -5
- package/esm/cards/ContentCard/ContentCardHeader.js +60 -23
- package/esm/cards/ContentCard/__figma__/ContentCard.figma.js +9 -6
- package/esm/cards/DataCard.js +35 -0
- package/esm/cards/FeatureEntryCard.js +2 -2
- package/esm/cards/FeedCard.js +5 -0
- package/esm/cards/FloatingAssetCard.js +25 -0
- package/esm/cards/MediaCard/MediaCardLayout.js +68 -0
- package/esm/cards/MediaCard/__figma__/MediaCard.figma.js +41 -0
- package/esm/cards/MediaCard/index.js +45 -0
- package/esm/cards/MessagingCard/MessagingCardLayout.js +175 -0
- package/esm/cards/MessagingCard/__figma__/MessagingCard.figma.js +44 -0
- package/esm/cards/MessagingCard/index.js +58 -0
- package/esm/cards/NudgeCard.js +27 -0
- package/esm/cards/UpsellCard.js +27 -0
- package/esm/cards/__stories__/ContentCard.stories.js +375 -47
- package/esm/cards/__stories__/MediaCard.stories.js +189 -0
- package/esm/cards/__stories__/MessagingCard.stories.js +535 -0
- package/esm/cards/__stories__/NudgeCard.stories.js +2 -2
- package/esm/cards/__stories__/UpsellCard.stories.js +2 -2
- package/esm/cards/index.js +8 -1
- package/esm/examples/ExampleScreen.js +2 -2
- package/package.json +2 -2
- package/dts/cards/CardRemoteImage.d.ts +0 -5
- package/dts/cards/CardRemoteImage.d.ts.map +0 -1
- package/dts/cards/ContentCard/__figma__/ContentCardBody.figma.d.ts +0 -2
- package/dts/cards/ContentCard/__figma__/ContentCardBody.figma.d.ts.map +0 -1
- package/dts/cards/ContentCard/__figma__/ContentCardFooter.figma.d.ts +0 -2
- package/dts/cards/ContentCard/__figma__/ContentCardFooter.figma.d.ts.map +0 -1
- package/dts/cards/ContentCard/__figma__/ContentCardHeader.figma.d.ts +0 -2
- package/dts/cards/ContentCard/__figma__/ContentCardHeader.figma.d.ts.map +0 -1
- package/esm/cards/CardRemoteImage.js +0 -18
- package/esm/cards/ContentCard/__figma__/ContentCardBody.figma.js +0 -39
- package/esm/cards/ContentCard/__figma__/ContentCardFooter.figma.js +0 -142
- package/esm/cards/ContentCard/__figma__/ContentCardHeader.figma.js +0 -25
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { assets, ethBackground } from '@coinbase/cds-common/internal/data/assets';
|
|
4
|
+
import { NoopFn } from '@coinbase/cds-common/utils/mockUtils';
|
|
5
|
+
import { Carousel } from '../../carousel/Carousel';
|
|
6
|
+
import { CarouselItem } from '../../carousel/CarouselItem';
|
|
7
|
+
import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
8
|
+
import { RemoteImage } from '../../media/RemoteImage';
|
|
9
|
+
import { TextHeadline, TextLabel2, TextTitle3 } from '../../typography';
|
|
10
|
+
import { Text } from '../../typography/Text';
|
|
11
|
+
import { MediaCard } from '../MediaCard';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const exampleProps = {
|
|
14
|
+
title: 'Title',
|
|
15
|
+
subtitle: 'Subtitle',
|
|
16
|
+
description: 'Description'
|
|
17
|
+
};
|
|
18
|
+
const exampleThumbnail = /*#__PURE__*/_jsx(RemoteImage, {
|
|
19
|
+
accessibilityLabel: "Ethereum thumbnail",
|
|
20
|
+
shape: "circle",
|
|
21
|
+
size: "l",
|
|
22
|
+
source: ethBackground,
|
|
23
|
+
testID: "thumbnail"
|
|
24
|
+
});
|
|
25
|
+
const exampleMedia = /*#__PURE__*/_jsx(RemoteImage, {
|
|
26
|
+
accessibilityLabel: "Ethereum media",
|
|
27
|
+
height: "100%",
|
|
28
|
+
resizeMode: "cover",
|
|
29
|
+
shape: "rectangle",
|
|
30
|
+
source: ethBackground,
|
|
31
|
+
width: "100%"
|
|
32
|
+
});
|
|
33
|
+
const MediaCardScreen = () => {
|
|
34
|
+
const ref = useRef(null);
|
|
35
|
+
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
36
|
+
children: [/*#__PURE__*/_jsx(Example, {
|
|
37
|
+
title: "Default",
|
|
38
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({
|
|
39
|
+
ref: ref
|
|
40
|
+
}, exampleProps, {
|
|
41
|
+
thumbnail: exampleThumbnail
|
|
42
|
+
}))
|
|
43
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
44
|
+
title: "With Media",
|
|
45
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({}, exampleProps, {
|
|
46
|
+
media: exampleMedia,
|
|
47
|
+
thumbnail: exampleThumbnail
|
|
48
|
+
}))
|
|
49
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
50
|
+
title: "Media Placement Start",
|
|
51
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({}, exampleProps, {
|
|
52
|
+
media: exampleMedia,
|
|
53
|
+
mediaPlacement: "start",
|
|
54
|
+
thumbnail: exampleThumbnail
|
|
55
|
+
}))
|
|
56
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
57
|
+
title: "Media Placement End",
|
|
58
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({}, exampleProps, {
|
|
59
|
+
media: exampleMedia,
|
|
60
|
+
mediaPlacement: "end",
|
|
61
|
+
thumbnail: exampleThumbnail
|
|
62
|
+
}))
|
|
63
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
64
|
+
title: "Long Text",
|
|
65
|
+
children: /*#__PURE__*/_jsx(MediaCard, {
|
|
66
|
+
description: "This is a very long description text that demonstrates how the card handles longer content",
|
|
67
|
+
media: exampleMedia,
|
|
68
|
+
subtitle: "This is a very long subtitle text that will get truncated",
|
|
69
|
+
thumbnail: exampleThumbnail,
|
|
70
|
+
title: "This is a very long title text that will get truncated"
|
|
71
|
+
})
|
|
72
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
73
|
+
title: "Custom Content",
|
|
74
|
+
children: /*#__PURE__*/_jsx(MediaCard, {
|
|
75
|
+
description: /*#__PURE__*/_jsxs(TextLabel2, {
|
|
76
|
+
children: ["Custom description with ", /*#__PURE__*/_jsx(Text, {
|
|
77
|
+
font: "headline",
|
|
78
|
+
children: "bold text"
|
|
79
|
+
}), " and", ' ', /*#__PURE__*/_jsx(Text, {
|
|
80
|
+
font: "label1",
|
|
81
|
+
children: "italic text"
|
|
82
|
+
})]
|
|
83
|
+
}),
|
|
84
|
+
media: exampleMedia,
|
|
85
|
+
subtitle: /*#__PURE__*/_jsx(TextHeadline, {
|
|
86
|
+
color: "fgPositive",
|
|
87
|
+
children: "Custom Subtitle"
|
|
88
|
+
}),
|
|
89
|
+
thumbnail: exampleThumbnail,
|
|
90
|
+
title: /*#__PURE__*/_jsx(TextTitle3, {
|
|
91
|
+
children: "Custom Title"
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
95
|
+
title: "With Layout Overrides",
|
|
96
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({}, exampleProps, {
|
|
97
|
+
media: exampleMedia,
|
|
98
|
+
styles: {
|
|
99
|
+
layoutContainer: {
|
|
100
|
+
gap: 3
|
|
101
|
+
},
|
|
102
|
+
contentContainer: {
|
|
103
|
+
padding: 3,
|
|
104
|
+
gap: 2
|
|
105
|
+
},
|
|
106
|
+
textContainer: {
|
|
107
|
+
gap: 1
|
|
108
|
+
},
|
|
109
|
+
headerContainer: {
|
|
110
|
+
gap: 1
|
|
111
|
+
},
|
|
112
|
+
mediaContainer: {
|
|
113
|
+
borderRadius: 300
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
thumbnail: exampleThumbnail
|
|
117
|
+
}))
|
|
118
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
119
|
+
title: "With Root Style Override",
|
|
120
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({}, exampleProps, {
|
|
121
|
+
media: exampleMedia,
|
|
122
|
+
styles: {
|
|
123
|
+
root: {
|
|
124
|
+
borderWidth: 2,
|
|
125
|
+
borderColor: 'blue'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
thumbnail: exampleThumbnail
|
|
129
|
+
}))
|
|
130
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
131
|
+
title: "Interactive with onPress",
|
|
132
|
+
children: /*#__PURE__*/_jsx(MediaCard, {
|
|
133
|
+
renderAsPressable: true,
|
|
134
|
+
accessibilityLabel: "View interactive card details",
|
|
135
|
+
description: "Clickable card with onPress handler",
|
|
136
|
+
media: exampleMedia,
|
|
137
|
+
onPress: () => console.log('Card clicked!'),
|
|
138
|
+
subtitle: "Button",
|
|
139
|
+
thumbnail: exampleThumbnail,
|
|
140
|
+
title: "Interactive Card"
|
|
141
|
+
})
|
|
142
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
143
|
+
title: "Multiple Cards",
|
|
144
|
+
children: /*#__PURE__*/_jsxs(Carousel, {
|
|
145
|
+
styles: {
|
|
146
|
+
carousel: {
|
|
147
|
+
gap: 16
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
children: [/*#__PURE__*/_jsx(CarouselItem, {
|
|
151
|
+
id: "card1",
|
|
152
|
+
children: /*#__PURE__*/_jsx(MediaCard, _extends({}, exampleProps, {
|
|
153
|
+
media: exampleMedia,
|
|
154
|
+
thumbnail: exampleThumbnail
|
|
155
|
+
}))
|
|
156
|
+
}), /*#__PURE__*/_jsx(CarouselItem, {
|
|
157
|
+
id: "card2",
|
|
158
|
+
children: /*#__PURE__*/_jsx(MediaCard, {
|
|
159
|
+
renderAsPressable: true,
|
|
160
|
+
accessibilityLabel: "View Bitcoin details",
|
|
161
|
+
description: "Another card with different content",
|
|
162
|
+
media: exampleMedia,
|
|
163
|
+
onPress: NoopFn,
|
|
164
|
+
subtitle: "BTC",
|
|
165
|
+
thumbnail: /*#__PURE__*/_jsx(RemoteImage, {
|
|
166
|
+
accessibilityLabel: "Bitcoin thumbnail",
|
|
167
|
+
shape: "circle",
|
|
168
|
+
size: "l",
|
|
169
|
+
source: assets.btc.imageUrl
|
|
170
|
+
}),
|
|
171
|
+
title: "Bitcoin"
|
|
172
|
+
})
|
|
173
|
+
}), /*#__PURE__*/_jsx(CarouselItem, {
|
|
174
|
+
id: "card3",
|
|
175
|
+
children: /*#__PURE__*/_jsx(MediaCard, {
|
|
176
|
+
renderAsPressable: true,
|
|
177
|
+
accessibilityLabel: "View Ethereum details",
|
|
178
|
+
description: "Card with onPress handler",
|
|
179
|
+
onPress: NoopFn,
|
|
180
|
+
subtitle: "ETH",
|
|
181
|
+
thumbnail: exampleThumbnail,
|
|
182
|
+
title: "Ethereum"
|
|
183
|
+
})
|
|
184
|
+
})]
|
|
185
|
+
})
|
|
186
|
+
})]
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
export default MediaCardScreen;
|