@anker-in/campaign-ui 0.2.10-beta.17 → 0.2.10-beta.19

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 (41) hide show
  1. package/dist/cjs/components/credits/creditsBanner/index.js +1 -1
  2. package/dist/cjs/components/credits/creditsBanner/index.js.map +2 -2
  3. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +1 -1
  4. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +2 -2
  5. package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
  6. package/dist/cjs/components/credits/creditsBenefits/index.js.map +2 -2
  7. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  8. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +2 -2
  9. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  10. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
  11. package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
  12. package/dist/cjs/components/credits/modal/activitiesModal.js.map +2 -2
  13. package/dist/cjs/components/credits/modal/loadingDots.d.ts +2 -1
  14. package/dist/cjs/components/credits/modal/loadingDots.js +1 -1
  15. package/dist/cjs/components/credits/modal/loadingDots.js.map +3 -3
  16. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  17. package/dist/esm/components/credits/creditsBanner/index.js +1 -1
  18. package/dist/esm/components/credits/creditsBanner/index.js.map +2 -2
  19. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +1 -1
  20. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +2 -2
  21. package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
  22. package/dist/esm/components/credits/creditsBenefits/index.js.map +2 -2
  23. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  24. package/dist/esm/components/credits/creditsInfoCard/index.js.map +2 -2
  25. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  26. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  27. package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
  28. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  29. package/dist/esm/components/credits/modal/loadingDots.d.ts +2 -1
  30. package/dist/esm/components/credits/modal/loadingDots.js +1 -1
  31. package/dist/esm/components/credits/modal/loadingDots.js.map +3 -3
  32. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
  34. package/src/components/credits/creditsBanner/index.tsx +1 -1
  35. package/src/components/credits/creditsBenefits/benefitItem.tsx +1 -1
  36. package/src/components/credits/creditsBenefits/index.tsx +3 -3
  37. package/src/components/credits/creditsInfoCard/index.tsx +2 -2
  38. package/src/components/credits/modal/MyRewardsModal.tsx +73 -69
  39. package/src/components/credits/modal/activitiesModal.tsx +50 -47
  40. package/src/components/credits/modal/loadingDots.tsx +9 -7
  41. package/tailwind.config.ts +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/campaign-ui",
3
- "version": "0.2.10-beta.17",
3
+ "version": "0.2.10-beta.19",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
@@ -56,7 +56,7 @@ export function CreditsBanner({ copy }: BannerProps) {
56
56
 
57
57
  <Container className="l:h-auto !absolute inset-0 mx-auto grid h-full" asChild>
58
58
  <div className="grid grid-cols-12">
59
- <div className="l:col-span-12 l:justify-start l:pt-[64px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]">
59
+ <div className="l:col-span-12 l:justify-start l:truncate l:pt-[64px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]">
60
60
  <Heading
61
61
  as="h1"
62
62
  size="5"
@@ -24,7 +24,7 @@ const BenefitItem = ({
24
24
  }) => {
25
25
  return (
26
26
  <div
27
- className="relative h-full rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]"
27
+ className="relative flex-1 flex flex-col rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]"
28
28
  style={{
29
29
  background: 'linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)',
30
30
  }}
@@ -48,7 +48,7 @@ export const CreditsBenefits = ({ copy }: CreditsBenefitsProps) => {
48
48
  return (
49
49
  <Container id="benefits" className="!z-[30] bg-[#F5F5F7]">
50
50
  <Heading as="h2" size="4" html={copy?.title} />
51
- <div className="mt-[24px] grid grid-cols-2 gap-[16px] l:hidden min-md:grid-cols-3 min-xl:grid-cols-4">
51
+ <div className="mt-[24px] grid grid-cols-4 xl:grid-cols-3 gap-[16px] l:hidden items-stretch">
52
52
  {copy.benefits.map((item, index) => (
53
53
  <BenefitItem
54
54
  key={index}
@@ -74,7 +74,7 @@ export const CreditsBenefits = ({ copy }: CreditsBenefitsProps) => {
74
74
  slidesPerGroup: 3,
75
75
  },
76
76
  }}
77
- wrapperClass="items-stretch"
77
+ wrapperClass="!items-stretch"
78
78
  modules={[Grid, Pagination]}
79
79
  pagination={{
80
80
  clickable: true,
@@ -86,7 +86,7 @@ export const CreditsBenefits = ({ copy }: CreditsBenefitsProps) => {
86
86
  }}
87
87
  >
88
88
  {copy.benefits.map((item, index) => (
89
- <SwiperSlide key={index} className={cn('!h-auto', activeNoteIndex === index && '!z-[100]')}>
89
+ <SwiperSlide key={index} className={cn('!h-auto !flex', activeNoteIndex === index && '!z-[100]')}>
90
90
  <BenefitItem
91
91
  item={item}
92
92
  handleClick={handleClick}
@@ -52,7 +52,7 @@ export function CreditsInfoCard({ data }: InfoCardProps) {
52
52
  <div
53
53
  className={cn(
54
54
  'mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]',
55
- 'l:flex-col',
55
+ 'l:flex-col l:items-start',
56
56
  'min-l:px-[48px]',
57
57
  'min-xl:px-[100px]'
58
58
  )}
@@ -64,7 +64,7 @@ export function CreditsInfoCard({ data }: InfoCardProps) {
64
64
  >
65
65
  <div
66
66
  className={cn(
67
- 'grid grid-cols-2 gap-[24px] font-bold md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center'
67
+ 'grid grid-cols-2 gap-[24px] font-bold l:w-full md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center'
68
68
  )}
69
69
  >
70
70
  <div className="mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]">
@@ -42,7 +42,6 @@ interface MyRewardsModalProps extends ModalContainerProps {
42
42
 
43
43
  function MyRewardsModal({ data, ...props }: MyRewardsModalProps) {
44
44
  const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)
45
- console.log('data123', data)
46
45
 
47
46
  const [couponPage, setCouponPage] = useState(1)
48
47
  const [productPage, setProductPage] = useState(1)
@@ -210,17 +209,19 @@ function MyRewardsModal({ data, ...props }: MyRewardsModalProps) {
210
209
  }, 2000)
211
210
  }, [])
212
211
 
212
+ const isLoading = activeTab === AlpcConsumeType.Coupon ? couponIsLoading : productIsLoading
213
+
213
214
  return (
214
215
  <CreditsModalContainer
215
216
  title={data.title}
216
217
  className={classNames('h-[800px] w-[640px]')}
217
218
  useAnimation
218
219
  animationClassName="md:translate-y-[100vh]"
219
- scrollClassName="min-l:px-0 md:mb-0 md:px-0"
220
+ scrollClassName="md:mb-0"
220
221
  {...props}
221
222
  onScrollEnd={handleScrollEnd}
222
223
  >
223
- <div className="px-[24px] md:px-[16px]">
224
+ <div className="">
224
225
  <Tabs
225
226
  align="left"
226
227
  shape="rounded"
@@ -239,77 +240,80 @@ function MyRewardsModal({ data, ...props }: MyRewardsModalProps) {
239
240
  </Tabs>
240
241
  </div>
241
242
 
242
- <div className="mt-[24px] overflow-auto overscroll-contain px-[24px] md:px-[16px]">
243
- {!list.length && !couponIsLoading && !productIsLoading && (
244
- <div className="flex h-full flex-col items-center justify-center">
245
- <Picture
246
- className="mb-[12px] w-[160px]"
247
- source={data?.emptyListImage?.url}
248
- alt={data?.emptyListImage?.alt || 'empty list image'}
249
- ></Picture>
250
- <div className="text-[16px] font-semibold leading-[1.4]">{data?.emptyListLabel}</div>
251
- </div>
252
- )}
253
- {couponIsLoading ||
254
- (productIsLoading && (
255
- <div className="flex h-full flex-col items-center justify-center">
256
- <LoadingDots />
257
- </div>
258
- ))}
259
- <div className="grid gap-[18px] md:gap-[12px]">
260
- {list.map((item, index) => (
261
- <div key={index} className="grid gap-[8px]">
262
- {item?.orderNumber && (
263
- <div className="text-[15px] font-semibold leading-[1.4] text-[#777]">
264
- {data.orderNumberLabel}: {item.orderNumber}
265
- </div>
266
- )}
267
- <div className="flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]">
268
- <div className="grid gap-[4px]">
269
- <div className="text-[16px] font-bold leading-[1.4]">{item.title}</div>
270
- <div className="text-[14px] font-semibold text-[#999]">
271
- {data.valueLabel}: {item.value} {data?.pointUnit}
272
- </div>
273
- <div className="text-[14px] font-semibold text-[#999]">
274
- {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}
275
- {item?.couponCode && (
276
- <span
277
- className="cursor-pointer text-[14px] font-semibold text-brand underline"
278
- onClick={() => {
279
- handleCopy(item.couponCode, index)
280
- }}
281
- role="button"
282
- tabIndex={0}
283
- onKeyDown={e => {
284
- if (e.key === 'Enter' || e.key === ' ') {
285
- e.preventDefault()
286
- }
287
- }}
243
+ {isLoading && (
244
+ <div className="flex h-full flex-col items-center justify-center">
245
+ <LoadingDots />
246
+ </div>
247
+ )}
248
+
249
+ {!isLoading && (
250
+ <div className="mt-[24px] overflow-auto overscroll-contain">
251
+ {list.length > 0 ? (
252
+ <div className="grid gap-[18px] md:gap-[12px]">
253
+ {list.map((item, index) => (
254
+ <div key={index} className="grid gap-[8px]">
255
+ {item?.orderNumber && (
256
+ <div className="text-[15px] font-semibold leading-[1.4] text-[#777]">
257
+ {data.orderNumberLabel}: {item.orderNumber}
258
+ </div>
259
+ )}
260
+ <div className="flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]">
261
+ <div className="grid gap-[4px]">
262
+ <div className="text-[16px] font-bold leading-[1.4]">{item.title}</div>
263
+ <div className="text-[14px] font-semibold text-[#999]">
264
+ {data.valueLabel}: {item.value} {data?.pointUnit}
265
+ </div>
266
+ <div className="text-[14px] font-semibold text-[#999]">
267
+ {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}
268
+ {item?.couponCode && (
269
+ <span
270
+ className="cursor-pointer text-[14px] font-semibold text-brand underline"
271
+ onClick={() => {
272
+ handleCopy(item.couponCode, index)
273
+ }}
274
+ role="button"
275
+ tabIndex={0}
276
+ onKeyDown={e => {
277
+ if (e.key === 'Enter' || e.key === ' ') {
278
+ e.preventDefault()
279
+ }
280
+ }}
281
+ >
282
+ {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}
283
+ </span>
284
+ )}
285
+ </div>
286
+ </div>
287
+ <div className="grid gap-[4px] text-right">
288
+ <div
289
+ className={classNames(
290
+ 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',
291
+ `text-[${ColorMap[item.type]}]`
292
+ )}
288
293
  >
289
- {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}
290
- </span>
291
- )}
294
+ <span>{TypeMap[item.type]}</span>
295
+ {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}
296
+ </div>
297
+ <div className="text-[14px] font-semibold text-[#999]">
298
+ {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}
299
+ </div>
300
+ </div>
292
301
  </div>
293
302
  </div>
294
- <div className="grid gap-[4px] text-right">
295
- <div
296
- className={classNames(
297
- 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',
298
- `text-[${ColorMap[item.type]}]`
299
- )}
300
- >
301
- <span>{TypeMap[item.type]}</span>
302
- {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}
303
- </div>
304
- <div className="text-[14px] font-semibold text-[#999]">
305
- {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}
306
- </div>
307
- </div>
308
- </div>
303
+ ))}
309
304
  </div>
310
- ))}
305
+ ) : (
306
+ <div className="flex h-full flex-col items-center justify-center">
307
+ <Picture
308
+ className="mb-[12px] w-[160px]"
309
+ source={data?.emptyListImage?.url}
310
+ alt={data?.emptyListImage?.alt || 'empty list image'}
311
+ ></Picture>
312
+ <div className="text-[16px] font-semibold leading-[1.4]">{data?.emptyListLabel}</div>
313
+ </div>
314
+ )}
311
315
  </div>
312
- </div>
316
+ )}
313
317
  </CreditsModalContainer>
314
318
  )
315
319
  }
@@ -171,11 +171,11 @@ function ActivitiesModal({ data, ...props }: ActivitiesModalProps) {
171
171
  className={cn('h-[800px] w-[640px]')}
172
172
  useAnimation
173
173
  animationClassName="md:translate-y-[100vh]"
174
- scrollClassName="min-l:px-0 md:mb-0 md:px-0"
174
+ scrollClassName=""
175
175
  {...props}
176
176
  onScrollEnd={handleScrollEnd}
177
177
  >
178
- <div className="w-full overflow-x-auto">
178
+ <div className="w-full sticky top-0 bg-white z-10 pb-[24px] overflow-x-auto">
179
179
  <Tabs
180
180
  align="left"
181
181
  shape="rounded"
@@ -183,7 +183,7 @@ function ActivitiesModal({ data, ...props }: ActivitiesModalProps) {
183
183
  onValueChange={value => {
184
184
  setActiveTab(Number(value))
185
185
  }}
186
- className="px-[24px] md:px-[16px]"
186
+ className=""
187
187
  >
188
188
  <TabsList>
189
189
  {tabs.map(tab => (
@@ -195,59 +195,62 @@ function ActivitiesModal({ data, ...props }: ActivitiesModalProps) {
195
195
  </Tabs>
196
196
  </div>
197
197
 
198
- <div className="mt-[24px] grid gap-[18px] overflow-auto overscroll-contain px-[24px] md:gap-[12px] md:px-[16px]">
198
+ <div className="grid gap-[18px] overflow-auto overscroll-contain md:gap-[12px]">
199
199
  {isLoading && (
200
200
  <div className="flex h-full flex-col items-center justify-center">
201
201
  <LoadingDots />
202
202
  </div>
203
203
  )}
204
- {!list.length && !isLoading && (
205
- <div className="flex h-full flex-col items-center justify-center">
206
- <Picture
207
- className="mb-[16px] h-[120px] w-[160px]"
208
- source={data?.emptyListImage?.url}
209
- alt={data?.emptyListImage?.alt || 'empty list image'}
210
- ></Picture>
211
- <div className="leading-1.4 text-[16px] font-semibold">{data?.emptyListLabel}</div>
212
- </div>
213
- )}
214
- {list.map((item, index) => (
215
- <div
216
- key={index}
217
- className="flex h-fit items-center justify-between rounded-[8px] bg-[#f2f0f1] px-[16px] py-[20px] text-[16px]"
218
- >
219
- <div className="grid gap-[6px]">
220
- <div className="font-bold">{item.title}</div>
221
- <div className="text-[14px] font-semibold text-[#999]">
222
- {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}
223
- </div>
224
- {!data.pendingTips && (
204
+
205
+ {!isLoading && (
206
+ <>
207
+ {list.length > 0 ? (
208
+ list.map((item, index) => (
225
209
  <div
226
- className={`hidden text-[14px] font-semibold text-[#777] ${item.status === 2 && item.credit_type === 1 ? '!flex' : ''}`}
210
+ key={index}
211
+ className="flex h-fit items-center justify-between rounded-[8px] bg-[#f2f0f1] px-[16px] py-[20px] text-[16px]"
227
212
  >
228
- <Text html={data.pendingTips} />
229
- <span>{dayjs.unix(item.pending_time).add(1, 'day').format('YYYY-MM-DD')}</span>
230
- {data.pendingTips2 && <Text html={data.pendingTips2} />}
213
+ <div className="grid gap-[6px]">
214
+ <div className="font-bold">{item.title}</div>
215
+ <div className="text-[14px] font-semibold text-[#999]">
216
+ {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}
217
+ </div>
218
+ {!data.pendingTips && (
219
+ <div
220
+ className={`hidden text-[14px] font-semibold text-[#777] ${item.status === 2 && item.credit_type === 1 ? '!flex' : ''}`}
221
+ >
222
+ <Text html={data.pendingTips} />
223
+ <span>{dayjs.unix(item.pending_time).add(1, 'day').format('YYYY-MM-DD')}</span>
224
+ {data.pendingTips2 && <Text html={data.pendingTips2} />}
225
+ </div>
226
+ )}
227
+ </div>
228
+ <div
229
+ className={cn(
230
+ 'font-bold',
231
+ item.value >= 0 || item.credit_type === CreditType.Expired ? 'text-[#52C41A]' : 'text-[#F84D4F]'
232
+ )}
233
+ >
234
+ {item.value >= 0 && '+'}
235
+ {item.value}
236
+ </div>
231
237
  </div>
232
- )}
233
- </div>
234
- <div
235
- className={cn(
236
- 'font-bold',
237
- item.value >= 0 || item.credit_type === CreditType.Expired ? 'text-[#52C41A]' : 'text-[#F84D4F]'
238
- )}
239
- >
240
- {item.value >= 0 && '+'}
241
- {item.value}
242
- </div>
243
- </div>
244
- ))}
238
+ ))
239
+ ) : (
240
+ <div className="flex h-full flex-col items-center justify-center">
241
+ <Picture
242
+ className="mb-[16px] h-[120px] w-[160px]"
243
+ source={data?.emptyListImage?.url}
244
+ alt={data?.emptyListImage?.alt || 'empty list image'}
245
+ ></Picture>
246
+ <div className="leading-1.4 text-[16px] font-semibold">{data?.emptyListLabel}</div>
247
+ </div>
248
+ )}
249
+ </>
250
+ )}
245
251
  </div>
246
- {!!list.length && (
247
- <div className="mt-[12px] px-[24px] pb-[24px] text-[14px] font-semibold text-[#999] md:px-[16px]">
248
- {data.tips}
249
- </div>
250
- )}
252
+ {/* 积分到账时间提醒 */}
253
+ {list.length > 0 && <div className="mt-[12px] pb-[24px] text-[14px] font-semibold text-[#999]">{data.tips}</div>}
251
254
  </CreditsModalContainer>
252
255
  )
253
256
  }
@@ -1,16 +1,18 @@
1
- import { cn } from '../../../helpers/utils'
1
+ import classNames from 'classnames'
2
+ import { FC } from 'react'
2
3
 
3
4
  interface LoadingProps {
4
5
  className?: string
5
6
  }
6
7
 
7
- function LoadingDots({ className }: LoadingProps) {
8
+ const LoadingDots: FC<LoadingProps> = props => {
9
+ const { className } = props
8
10
  return (
9
- <div className={cn(className)}>
10
- <span className="dot" key={`dot_1`} />
11
- <span className="dot" key={`dot_2`} />
12
- <span className="dot" key={`dot_3`} />
13
- </div>
11
+ <span className={classNames('inline-flex min-h-[19px] items-center text-center leading-7', className)}>
12
+ <span className="animate-blink mx-0.5 h-2 w-2 rounded-full bg-current" key={`dot_1`} />
13
+ <span className="animate-blink mx-0.5 h-2 w-2 rounded-full bg-current [animation-delay:0.2s]" key={`dot_2`} />
14
+ <span className="animate-blink mx-0.5 h-2 w-2 rounded-full bg-current [animation-delay:0.4s]" key={`dot_3`} />
15
+ </span>
14
16
  )
15
17
  }
16
18
 
@@ -66,6 +66,16 @@ export default {
66
66
  letterSpacing: {
67
67
  DEFAULT: 'var(--letter-spacing-normal)',
68
68
  },
69
+ keyframes: {
70
+ blink: {
71
+ '0%': { opacity: '0.2' },
72
+ '20%': { opacity: '1' },
73
+ '100%': { opacity: '0.2' },
74
+ },
75
+ },
76
+ animation: {
77
+ blink: 'blink 1.6s infinite both',
78
+ },
69
79
  },
70
80
  },
71
81
  plugins: [],