@capillarytech/creatives-library 6.8.7 → 6.8.8

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 (30) hide show
  1. package/components/TemplatePreview/_templatePreview.scss +6 -0
  2. package/components/TemplatePreview/index.js +35 -28
  3. package/package.json +1 -1
  4. package/v2Components/Carousel/index.js +120 -0
  5. package/v2Components/Carousel/style.scss +40 -0
  6. package/v2Components/TemplatePreview/_templatePreview.scss +381 -380
  7. package/v2Components/TemplatePreview/index.js +36 -29
  8. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -1
  9. package/v2Containers/Line/Container/Image/index.js +21 -19
  10. package/v2Containers/Line/Container/ImageCarousel/Content.js +554 -0
  11. package/v2Containers/Line/Container/ImageCarousel/constants.js +10 -0
  12. package/v2Containers/Line/Container/ImageCarousel/index.js +526 -0
  13. package/v2Containers/Line/Container/ImageCarousel/messages.js +178 -0
  14. package/v2Containers/Line/Container/ImageCarousel/style.js +61 -0
  15. package/v2Containers/Line/Container/ImageMap/constants.js +2 -1
  16. package/v2Containers/Line/Container/ImageMap/index.js +31 -6
  17. package/v2Containers/Line/Container/ImageMap/messages.js +12 -0
  18. package/v2Containers/Line/Container/Wrapper/index.js +5 -1
  19. package/v2Containers/Line/Container/Wrapper/messages.js +4 -0
  20. package/v2Containers/Line/Container/Wrapper/utils.js +15 -16
  21. package/v2Containers/Line/Container/_lineCreate.scss +2 -2
  22. package/v2Containers/Line/Container/actions.js +4 -2
  23. package/v2Containers/Line/Container/constants.js +3 -0
  24. package/v2Containers/Line/Container/index.js +49 -11
  25. package/v2Containers/Line/Container/reducer.js +2 -2
  26. package/v2Containers/Line/Container/sagas.js +2 -2
  27. package/v2Containers/Line/Container/style.js +2 -1
  28. package/v2Containers/Templates/_templates.scss +414 -405
  29. package/v2Containers/Templates/index.js +29 -2
  30. package/v2Containers/Templates/messages.js +4 -0
@@ -616,4 +616,10 @@
616
616
  display: inline-block;
617
617
  background-color: #333333;
618
618
  margin-right: 4px;
619
+ }
620
+
621
+ .template-carousel.single-img {
622
+ .slick-track {
623
+ margin-left: 0;
624
+ }
619
625
  }
@@ -11,6 +11,7 @@ import _ from 'lodash';
11
11
  import { injectIntl, intlShape, FormattedMessage} from 'react-intl';
12
12
  import {CapColumn, CapTab, CapIcon, CapLabel, CapImage, CapTooltip} from '@capillarytech/cap-ui-library';
13
13
  import './_templatePreview.scss';
14
+ import Carousel from '../../v2Components/Carousel';
14
15
  import {updateCharCount} from '../../utils/smsCharCountV2';
15
16
  import messages from './messages';
16
17
  const smsIcon = require('./assets/images/user-icon.svg');
@@ -27,6 +28,7 @@ const smsBody = require('./assets/images/mobile.svg');
27
28
  const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
28
29
  const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
29
30
  import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
31
+ import { TEMPLATE, IMAGE_CAROUSEL, IMAGE_MAP_CAMEL_CASE, IMAGE, STICKER, TEXT } from '../../v2Containers/Line/Container/constants';
30
32
 
31
33
  class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
32
34
  getWechatAndroidPreview = (content) => (
@@ -349,35 +351,36 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
349
351
  selectedSticker = {
350
352
  stickerUrl: lineStickerPlaceholder,
351
353
  },
354
+ imageCarousel = [lineImgPlaceholder],
352
355
  } = item || {};
353
- if (type === 'text') {
356
+ const sectionStyle = {
357
+ background: CAP_WHITE,
358
+ color: FONT_COLOR_01,
359
+ borderRadius: 8,
360
+ position: 'static',
361
+ margin: '6px 0 20px 28px',
362
+ height: 'auto',
363
+ minHeight: 'auto',
364
+ overflow: 'initial',
365
+ maxHeight: 'initial',
366
+ };
367
+ if (type === TEXT) {
354
368
  return (
355
369
  <div
356
370
  className="message-pop align-left"
357
- style={{
358
- background: CAP_WHITE,
359
- color: FONT_COLOR_01,
360
- borderRadius: 8,
361
- position: 'static',
362
- margin: '6px 0 20px 28px',
363
- height: 'auto'
364
- }}
371
+ style={sectionStyle}
365
372
  >
366
373
  <p style={{ marginBottom: 5 }}>{messageContent || ''}</p>
367
374
  </div>
368
375
  );
369
376
  }
370
- if ((type === 'image' && previewImageUrl)) {
377
+ if ((type === IMAGE && previewImageUrl)) {
371
378
  return (
372
379
  <div
373
380
  className="message-pop align-left"
374
381
  style={{
375
- background: CAP_G08,
376
- color: FONT_COLOR_01,
377
- borderRadius: 8,
378
- position: 'static',
379
- margin: '6px 0 20px 28px',
380
- height: 184,
382
+ ...sectionStyle,
383
+ minHeight: 184,
381
384
  display: 'flex',
382
385
  justifyContent: 'center',
383
386
  alignItems: 'center',
@@ -396,17 +399,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
396
399
  </div>
397
400
  );
398
401
  }
399
- if ((type === 'imageMap' && baseUrl)) {
402
+ if ((type === IMAGE_MAP_CAMEL_CASE && baseUrl)) {
400
403
  return (
401
404
  <div
402
405
  className="message-pop align-left"
403
406
  style={{
404
- background: CAP_G08,
405
- color: FONT_COLOR_01,
406
- borderRadius: 8,
407
- position: 'static',
408
- margin: '6px 0 20px 28px',
409
- height: 184,
407
+ ...sectionStyle,
408
+ minHeight: 184,
410
409
  display: 'flex',
411
410
  justifyContent: 'center',
412
411
  alignItems: 'center',
@@ -425,16 +424,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
425
424
  </div>
426
425
  );
427
426
  }
428
- if (type === 'sticker' && selectedSticker) {
427
+ if (type === STICKER && selectedSticker) {
429
428
  return (
430
429
  <div
431
430
  className="message-pop align-left"
432
431
  style={{
432
+ ...sectionStyle,
433
433
  background: 'transparent',
434
- color: FONT_COLOR_01,
435
- color: FONT_COLOR_01,
436
- position: 'static',
437
- margin: '6px 0 20px 28px',
438
434
  display: 'flex',
439
435
  justifyContent: 'center',
440
436
  alignItems: 'center',
@@ -456,6 +452,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
456
452
  </div>
457
453
  );
458
454
  }
455
+ if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
456
+ return (
457
+ <div
458
+ style={{
459
+ margin: '40px 0 8px',
460
+ }}
461
+ >
462
+ <Carousel imageCarousel={imageCarousel}/>
463
+ </div>
464
+ )
465
+ }
459
466
  return null;
460
467
  })
461
468
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "6.8.7",
4
+ "version": "6.8.8",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -0,0 +1,120 @@
1
+ import React, { Component } from "react";
2
+ import { Carousel, Icon } from 'antd';
3
+ import './style.scss';
4
+ import CapImage from '@capillarytech/cap-ui-library/CapImage';
5
+ import CapButton from '@capillarytech/cap-ui-library/CapButton';
6
+ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
7
+ const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
8
+ import { CAP_WHITE, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
9
+
10
+ const arrowStyle = {
11
+ background: 'rgba(0, 0, 0, 0.1)',
12
+ display: 'block',
13
+ position: 'absolute',
14
+ color: CAP_WHITE,
15
+ padding: 0,
16
+ height: 24,
17
+ width: 24,
18
+ borderRadius: '50%',
19
+ }
20
+
21
+ const Arrow = props => {
22
+ const { className, style, onClick, extraStyle, type } = props
23
+ return (
24
+ <CapButton
25
+ className={className}
26
+ onClick={onClick}
27
+ type="flat"
28
+ style={{
29
+ ...style,
30
+ ...arrowStyle,
31
+ ...extraStyle,
32
+ }}
33
+ >
34
+ <CapIcon
35
+ type={type}
36
+ />
37
+ </CapButton>
38
+ )
39
+ }
40
+
41
+ const settings = {
42
+ nextArrow: (
43
+ <Arrow
44
+ extraStyle={{
45
+ right: 10,
46
+ }}
47
+ type="chevron-right"
48
+ />
49
+ ),
50
+ prevArrow: (
51
+ <Arrow
52
+ extraStyle={{
53
+ left: 8,
54
+ zIndex: 1,
55
+ }}
56
+ type="chevron-left"
57
+ />
58
+ ),
59
+ }
60
+
61
+ const CarouselComponent = ({
62
+ imageCarousel,
63
+ }) => {
64
+ let carousel = React.createRef();
65
+ const next = () => carousel.next();
66
+ const previous = () => carousel.prev();
67
+
68
+ const prop = {
69
+ dots: false,
70
+ infinite: true,
71
+ speed: 500,
72
+ slidesToShow: 1,
73
+ slidesToScroll: 0.5,
74
+ arrows: true,
75
+ swipeToSlide: true,
76
+ focusOnSelect: true,
77
+ rows: 1,
78
+ };
79
+
80
+ const imageCarouselLength = imageCarousel.length;
81
+
82
+ return (
83
+ <div style={{ position: 'relative' }} className={`template-carousel ${imageCarouselLength ? 'single-img' : ''}`}>
84
+ <Carousel ref={node => (carousel = node)} {...prop} {...settings}>
85
+ {
86
+ imageCarousel.map(({
87
+ actionLabel,
88
+ imageUrl = lineImgPlaceholder
89
+ }) => (
90
+ <div className="carousel-section">
91
+ <CapImage
92
+ src={imageUrl}
93
+ alt="brand-name"
94
+ rest={{
95
+ style: {
96
+ maxWidth: '100%',
97
+ },
98
+ }}
99
+ />
100
+ <span
101
+ style={{
102
+ position: 'relative',
103
+ bottom: 90,
104
+ background: 'rgba(94, 108, 132, 0.33)',
105
+ borderRadius: '42%',
106
+ padding: '0 12px',
107
+ color: CAP_WHITE,
108
+ }}
109
+ >
110
+ {actionLabel}
111
+ </span>
112
+ </div>
113
+ ))
114
+ }
115
+ </Carousel>
116
+ </div>
117
+ );
118
+ }
119
+
120
+ export default CarouselComponent;
@@ -0,0 +1,40 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ .template-carousel {
4
+ .slick-slide {
5
+ width: 120px !important;
6
+ margin-right: 6px;
7
+ }
8
+
9
+ .slick-track {
10
+ margin-left: 56px;
11
+ }
12
+
13
+ &.single-img {
14
+ .slick-track {
15
+ margin-left: 0;
16
+ }
17
+ }
18
+
19
+ .slick-list {
20
+ height: 180px;
21
+ }
22
+
23
+ .carousel-section {
24
+ height: 160px;
25
+ line-height: 160px;
26
+ text-align: center;
27
+ width: 120px !important;
28
+ border-radius: 12px;
29
+ background-color: $CAP_G09,
30
+ }
31
+
32
+ .ant-carousel .slick-slide {
33
+ .carousel-section {
34
+ img {
35
+ display: inline-block;
36
+ padding: 0 4px;
37
+ }
38
+ }
39
+ }
40
+ }