@automattic/social-previews 1.0.4 → 1.1.2

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.
@@ -1,112 +1,228 @@
1
1
  /*
2
2
  * CSS values in this file are specific and
3
- * designed to match the CSS on external sites,
4
- * such as Google and Facebook. Therefore there
3
+ * designed to match the CSS on Twitter. Therefore there
5
4
  * will be exceptions to our CSS guidelines here
6
- * but please do not "update" this file to
7
- * conform.
5
+ * but please do not "update" this file to conform.
8
6
  *
9
- * @blame: dmsnell
10
- */
7
+ * @blame: pento
8
+ */
11
9
 
12
10
  @import '../variables.scss';
13
11
 
14
12
  /* stylelint-disable scales/font-size */
15
13
 
16
14
  .twitter-preview {
15
+ background-color: #fff;
17
16
  padding: 20px;
18
- box-sizing: border-box;
17
+ width: 635px;
19
18
  }
20
19
 
21
- .twitter-preview__summary,
22
- .twitter-preview__large_image_summary {
23
- width: 506px;
24
- max-width: 100%;
25
- margin: 0 auto;
26
- overflow: hidden;
27
- border: 1px solid #e1e8ed;
28
- border-radius: 12px;
29
- }
30
-
31
- .twitter-preview__summary {
32
- height: 125px;
33
- }
34
-
35
- .twitter-preview__large_image_summary {
36
- height: auto;
37
- }
38
-
39
- .twitter-preview__image {
40
- background-size: cover;
41
- background-position: center;
42
- }
43
-
44
- .twitter-preview__summary .twitter-preview__image {
45
- float: left;
46
- width: 125px;
47
- height: 125px;
48
- }
49
-
50
- .twitter-preview__large_image_summary .twitter-preview__image {
51
- width: 506px;
52
- max-width: 100%;
53
- height: 254px;
54
- border-bottom: 1px solid #e1e8ed;
55
- }
56
-
57
- .twitter-preview__body {
58
- padding: 0.75em;
59
- text-decoration: none;
60
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
61
- font-size: $font-body-small;
62
- color: black;
63
- text-align: left;
64
- line-height: 1.3em;
65
- overflow: hidden;
66
- }
67
-
68
- .twitter-preview__summary .twitter-preview__body {
69
- margin-left: 125px;
70
- border-left: 1px solid #e1e8ed;
71
- height: 100%;
72
- }
73
-
74
- .twitter-preview__large_image_summary .twitter-preview__body {
75
- padding-left: 1em;
76
- padding-right: 1em;
77
- }
78
-
79
- .twitter-preview__title {
80
- max-height: 1.3em;
81
- white-space: nowrap;
82
- font-weight: bold;
83
- font-size: 1em;
84
- margin: 0 0 0.15em;
85
- overflow: hidden;
86
- text-overflow: ellipsis;
87
- }
88
-
89
- .twitter-preview__description {
90
- margin-top: 0.32333em;
91
- max-height: 3.9em;
92
- text-overflow: ellipsis;
93
- //clamp after two lines
94
- display: -webkit-box;
95
- -webkit-line-clamp: 2;
96
- -webkit-box-orient: vertical;
97
- overflow: hidden;
98
- }
99
-
100
- .twitter-preview__summary .twitter-preview__description {
101
- -webkit-line-clamp: 3;
102
- }
103
-
104
- .twitter-preview__url {
105
- text-transform: lowercase;
106
- color: #8899a6;
107
- max-height: 1.3em;
108
- white-space: nowrap;
109
- overflow: hidden;
110
- text-overflow: ellipsis;
111
- margin-top: 0.32333em;
20
+ .twitter-preview__container {
21
+ display: grid;
22
+ grid-template-columns: 65px auto;
23
+ margin-bottom: 5px;
24
+ margin-right: 24px;
25
+
26
+ .twitter-preview__sidebar {
27
+ display: grid;
28
+ grid-template-rows: 35px auto;
29
+ justify-items: center;
30
+
31
+ .twitter-preview__profile-image {
32
+ img {
33
+ height: 30px;
34
+ width: 30px;
35
+ border-radius: 15px;
36
+ object-fit: cover;
37
+ }
38
+ }
39
+
40
+ .twitter-preview__connector {
41
+ width: 2px;
42
+ background-color: #8c8f94;
43
+ }
44
+ }
45
+
46
+ .twitter-preview__name {
47
+ font-weight: bold;
48
+ font-size: 16px;
49
+ line-height: 19px;
50
+ }
51
+
52
+ .twitter-preview__screen-name,
53
+ .twitter-preview__date {
54
+ color: #667886;
55
+ font-size: 16px;
56
+ line-height: 18px;
57
+ letter-spacing: -0.3px;
58
+ margin-left: 15px;
59
+ }
60
+
61
+ .twitter-preview__content {
62
+ margin: 7px 0;
63
+
64
+ .twitter-preview__text {
65
+ font-size: 14px;
66
+ line-height: 18px;
67
+ letter-spacing: -0.3px;
68
+ color: #787c82;
69
+ white-space: pre-wrap;
70
+ word-break: break-word;
71
+ }
72
+
73
+ .twitter-preview__media {
74
+ border-radius: 15px;
75
+ overflow: hidden;
76
+ display: grid;
77
+ grid-gap: 2px;
78
+ grid-template-areas: 'a';
79
+ height: 300px;
80
+ margin-top: 10px;
81
+
82
+ img,
83
+ video {
84
+ width: 100%;
85
+ height: 100%;
86
+ object-fit: cover;
87
+
88
+ &:nth-child( 1 ) {
89
+ grid-area: a;
90
+ }
91
+ &:nth-child( 2 ) {
92
+ grid-area: b;
93
+ }
94
+ &:nth-child( 3 ) {
95
+ grid-area: c;
96
+ }
97
+ &:nth-child( 4 ) {
98
+ grid-area: d;
99
+ }
100
+ }
101
+
102
+ &.twitter-preview__media-children-2 {
103
+ grid-template-areas: 'a b';
104
+ }
105
+
106
+ &.twitter-preview__media-children-3 {
107
+ grid-template-areas: 'a b'
108
+ 'a c';
109
+ }
110
+
111
+ &.twitter-preview__media-children-4 {
112
+ grid-template-areas: 'a b'
113
+ 'c d';
114
+ }
115
+ }
116
+
117
+ .twitter-preview__quote-tweet {
118
+ margin-top: 10px;
119
+ min-height: 200px;
120
+
121
+ .twitter-preview__quote-tweet-overlay {
122
+ position: absolute;
123
+ top: 0;
124
+ left: 0;
125
+ right: 0;
126
+ bottom: 0;
127
+ opacity: 0;
128
+ }
129
+ }
130
+
131
+ .twitter-preview__card {
132
+ margin-top: 10px;
133
+ overflow: hidden;
134
+ border: 1px solid #e1e8ed;
135
+ border-radius: 12px;
136
+
137
+ .twitter-preview__card-summary {
138
+ display: grid;
139
+
140
+ &.twitter-preview__card-has-image {
141
+ height: 125px;
142
+ display: grid;
143
+ grid-template-columns: 125px auto;
144
+
145
+ .twitter-preview__card-body {
146
+ border-left: 1px solid #e1e8ed;
147
+ height: 100%;
148
+ }
149
+
150
+ .twitter-preview__card-description {
151
+ -webkit-line-clamp: 3;
152
+ }
153
+ }
154
+ }
155
+
156
+ .twitter-preview__card-summary_large_image {
157
+ display: grid;
158
+ grid-template-rows: 254px auto;
159
+ }
160
+
161
+ .twitter-preview__card-image {
162
+ width: 100%;
163
+ height: 100%;
164
+ object-fit: cover;
165
+ }
166
+
167
+ .twitter-preview__card-body {
168
+ padding: 0.75em;
169
+ text-decoration: none;
170
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
171
+ font-size: $font-body-small;
172
+ color: black;
173
+ text-align: left;
174
+ line-height: 1.3em;
175
+ overflow: hidden;
176
+ }
177
+
178
+ .twitter-preview__card-title {
179
+ max-height: 1.3em;
180
+ white-space: nowrap;
181
+ font-weight: bold;
182
+ font-size: 1em;
183
+ margin: 0 0 0.15em;
184
+ overflow: hidden;
185
+ text-overflow: ellipsis;
186
+ }
187
+
188
+ .twitter-preview__card-description {
189
+ margin-top: 0.32333em;
190
+ max-height: 3.9em;
191
+ text-overflow: ellipsis;
192
+ //clamp after two lines
193
+ display: -webkit-box;
194
+ -webkit-line-clamp: 2;
195
+ -webkit-box-orient: vertical;
196
+ overflow: hidden;
197
+ }
198
+
199
+ .twitter-preview__card-url {
200
+ text-transform: lowercase;
201
+ color: #8899a6;
202
+ max-height: 1.3em;
203
+ white-space: nowrap;
204
+ overflow-inline: hidden;
205
+ text-overflow: ellipsis;
206
+ margin-top: 0.32333em;
207
+
208
+ svg {
209
+ fill: #8899a6;
210
+ height: 15px;
211
+ width: 15px;
212
+ margin: 0 2px -4px 0;
213
+ }
214
+ }
215
+ }
216
+ }
217
+
218
+ .twitter-preview__footer {
219
+ display: grid;
220
+ grid-template-columns: repeat( 4, auto );
221
+
222
+ svg {
223
+ fill: #787c82;
224
+ height: 16px;
225
+ width: 16px;
226
+ }
227
+ }
112
228
  }
@@ -0,0 +1,346 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.Tweet = void 0;
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ var _i18n = require("@wordpress/i18n");
13
+
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _moment = _interopRequireDefault(require("moment"));
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _react = require("react");
21
+
22
+ var _helpers = require("../helpers");
23
+
24
+ require("./style.scss");
25
+
26
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
27
+
28
+ const __ = _i18n.__;
29
+ const DESCRIPTION_LENGTH = 200;
30
+
31
+ const baseDomain = url => url.replace(/^[^/]+[/]*(www\.)?/, '') // Strip leading protocol and "www.".
32
+ .replace(/\/.*$/, ''); // Strip everything after the domain.
33
+
34
+
35
+ const twitterDescription = (0, _helpers.firstValid)((0, _helpers.shortEnough)(DESCRIPTION_LENGTH), (0, _helpers.hardTruncation)(DESCRIPTION_LENGTH));
36
+
37
+ class Tweet extends _react.PureComponent {
38
+ /**
39
+ * Renders the sidebar beside the tweet.
40
+ *
41
+ * @param {string} profileImage URL of the Twitter profile image.
42
+ * @param {boolean} isLast Whether or not this is the last tweet in the in a thread.
43
+ * @returns {import('react').Element} The sidebar.
44
+ */
45
+ renderSidebar(profileImage, isLast) {
46
+ return (0, _jsxRuntime.jsxs)("div", {
47
+ className: "twitter-preview__sidebar",
48
+ children: [(0, _jsxRuntime.jsx)("div", {
49
+ className: "twitter-preview__profile-image",
50
+ children: (0, _jsxRuntime.jsx)("img", {
51
+ alt: __('Twitter profile image'),
52
+ src: profileImage
53
+ })
54
+ }), !isLast && (0, _jsxRuntime.jsx)("div", {
55
+ className: "twitter-preview__connector"
56
+ })]
57
+ });
58
+ }
59
+ /**
60
+ * Renders the header section of a single tweet.
61
+ *
62
+ * @param {string} name The display name of the Twitter account.
63
+ * @param {string} screenName The at-name of the Twitter account.
64
+ * @param {Date} date The date to be shown for this preview.
65
+ * @returns {import('react').Element} The header.
66
+ */
67
+
68
+
69
+ renderHeader(name, screenName, date) {
70
+ return (0, _jsxRuntime.jsxs)("div", {
71
+ className: "twitter-preview__header",
72
+ children: [(0, _jsxRuntime.jsx)("span", {
73
+ className: "twitter-preview__name",
74
+ children: name
75
+ }), (0, _jsxRuntime.jsx)("span", {
76
+ className: "twitter-preview__screen-name",
77
+ children: screenName
78
+ }), (0, _jsxRuntime.jsx)("span", {
79
+ className: "twitter-preview__date",
80
+ children: (0, _moment.default)(date).format('MMM D')
81
+ })]
82
+ });
83
+ }
84
+ /**
85
+ * Renders the text section of the tweet.
86
+ *
87
+ * @param {string} text The text of the tweet.
88
+ * @param {Array} urls Optional. An array of URLs that are in the text.
89
+ * @param {object} card Optional. The card data for this tweet.
90
+ * @returns {import('react').Element} The text section.
91
+ */
92
+
93
+
94
+ renderText(text) {
95
+ let urls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
96
+ let card = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
97
+ // If the text ends with the card URL, remove it.
98
+ const cardUrl = card.url || '';
99
+ const deCardedText = text.endsWith(cardUrl) ? text.substr(0, text.lastIndexOf(cardUrl)) : text;
100
+
101
+ const __html = urls.reduce((html, url) => html.replace(new RegExp('\\(' + url + '\\)', 'g'), `(<a href="${url}">${url}</a>)`), (0, _helpers.stripHtmlTags)(deCardedText).replace(new RegExp('\\n', 'g'), '<br/>')); // We can enable dangerouslySetInnerHTML here, since the text we're using is stripped
102
+ // of all HTML tags, then only has safe tags added in createTweetMarkup().
103
+
104
+ /* eslint-disable react/no-danger */
105
+
106
+
107
+ return (0, _jsxRuntime.jsx)("div", {
108
+ className: "twitter-preview__text",
109
+ dangerouslySetInnerHTML: {
110
+ __html
111
+ }
112
+ });
113
+ /* eslint-enabled react/no-danger */
114
+ }
115
+ /**
116
+ * Renders the media section of the tweet. It will render up to four individual images, or a single
117
+ * GIF, or a single video. Any media beyond these limits will be discarded.
118
+ *
119
+ * @param {Array} media The media to include in this tweet.
120
+ * @returns {import('react').Element} The media section.
121
+ */
122
+
123
+
124
+ renderMedia(media) {
125
+ if (!media) {
126
+ return;
127
+ } // Ensure we're only trying to show valid media, and the correct quantity.
128
+
129
+
130
+ const filteredMedia = media // Only image/ and video/ mime types are supported.
131
+ .filter(mediaItem => mediaItem.type.startsWith('image/') || mediaItem.type.startsWith('video/')).filter((mediaItem, idx, array) => {
132
+ // We'll always keep the first item.
133
+ if (0 === idx) {
134
+ return true;
135
+ } // If the first item was a video or GIF, discard all subsequent items.
136
+
137
+
138
+ if (array[0].type.startsWith('video/') || 'image/gif' === array[0].type) {
139
+ return false;
140
+ } // The first item wasn't a video or GIF, so discard all subsequent videos and GIFs.
141
+
142
+
143
+ if (mediaItem.type.startsWith('video/') || 'image/gif' === mediaItem.type) {
144
+ return false;
145
+ }
146
+
147
+ return true;
148
+ }) // We only want the first four items of the array, at most.
149
+ .slice(0, 4);
150
+ const isVideo = filteredMedia.length > 0 && filteredMedia[0].type.startsWith('video/');
151
+ const mediaClasses = (0, _classnames.default)(['twitter-preview__media', 'twitter-preview__media-children-' + filteredMedia.length]);
152
+
153
+ if (0 === filteredMedia.length) {
154
+ return;
155
+ }
156
+
157
+ return (0, _jsxRuntime.jsxs)("div", {
158
+ className: mediaClasses,
159
+ children: [
160
+ /* eslint-disable jsx-a11y/media-has-caption */
161
+ isVideo && filteredMedia.map((mediaItem, index) => (0, _jsxRuntime.jsxs)("video", {
162
+ controls: true,
163
+ children: [(0, _jsxRuntime.jsx)("source", {
164
+ src: mediaItem.url,
165
+ type: mediaItem.type
166
+ }), ' ']
167
+ }, `twitter-preview__media-item-${index}`))
168
+ /* eslint-disable jsx-a11y/media-has-caption */
169
+ , !isVideo && filteredMedia.map((mediaItem, index) => (0, _jsxRuntime.jsx)("img", {
170
+ alt: mediaItem.alt,
171
+ src: mediaItem.url
172
+ }, `twitter-preview__media-item-${index}`))]
173
+ });
174
+ }
175
+ /**
176
+ * Given a tweet URL, renders it as a quoted tweet.
177
+ *
178
+ * @param {string} tweet The tweet URL.
179
+ * @returns {import('react').Element} The quoted tweet.
180
+ */
181
+
182
+
183
+ renderQuoteTweet(tweet) {
184
+ if (!tweet) {
185
+ return;
186
+ }
187
+
188
+ return (0, _jsxRuntime.jsxs)("div", {
189
+ className: "twitter-preview__quote-tweet",
190
+ children: [(0, _jsxRuntime.jsx)(_components.SandBox, {
191
+ html: `<blockquote class="twitter-tweet" data-conversation="none" data-dnt="true"><a href="${tweet}"></a></blockquote>`,
192
+ scripts: ['https://platform.twitter.com/widgets.js'],
193
+ title: "Embedded tweet",
194
+ onFocus: this.hideOverlay
195
+ }), (0, _jsxRuntime.jsx)("div", {
196
+ className: "twitter-preview__quote-tweet-overlay"
197
+ })]
198
+ });
199
+ }
200
+ /**
201
+ * Given card data, renders the Twitter-style card.
202
+ *
203
+ * @param {object} card The card data.
204
+ * @returns {import('react').Element} The card tweet.
205
+ */
206
+
207
+
208
+ renderCard(card) {
209
+ if (!card) {
210
+ return;
211
+ }
212
+
213
+ const {
214
+ description,
215
+ image,
216
+ title,
217
+ type,
218
+ url
219
+ } = card;
220
+ const cardClassNames = (0, _classnames.default)(`twitter-preview__card-${type}`, {
221
+ 'twitter-preview__card-has-image': !!image
222
+ });
223
+ return (0, _jsxRuntime.jsx)("div", {
224
+ className: "twitter-preview__card",
225
+ children: (0, _jsxRuntime.jsxs)("div", {
226
+ className: cardClassNames,
227
+ children: [image && (0, _jsxRuntime.jsx)("img", {
228
+ className: "twitter-preview__card-image",
229
+ src: image,
230
+ alt: ""
231
+ }), (0, _jsxRuntime.jsxs)("div", {
232
+ className: "twitter-preview__card-body",
233
+ children: [(0, _jsxRuntime.jsx)("div", {
234
+ className: "twitter-preview__card-title",
235
+ children: title
236
+ }), (0, _jsxRuntime.jsx)("div", {
237
+ className: "twitter-preview__card-description",
238
+ children: twitterDescription((0, _helpers.stripHtmlTags)(description))
239
+ }), (0, _jsxRuntime.jsxs)("div", {
240
+ className: "twitter-preview__card-url",
241
+ children: [(0, _jsxRuntime.jsx)("svg", {
242
+ viewBox: "0 0 24 24",
243
+ children: (0, _jsxRuntime.jsxs)("g", {
244
+ children: [(0, _jsxRuntime.jsx)("path", {
245
+ d: "M11.96 14.945c-.067 0-.136-.01-.203-.027-1.13-.318-2.097-.986-2.795-1.932-.832-1.125-1.176-2.508-.968-3.893s.942-2.605 2.068-3.438l3.53-2.608c2.322-1.716 5.61-1.224 7.33 1.1.83 1.127 1.175 2.51.967 3.895s-.943 2.605-2.07 3.438l-1.48 1.094c-.333.246-.804.175-1.05-.158-.246-.334-.176-.804.158-1.05l1.48-1.095c.803-.592 1.327-1.463 1.476-2.45.148-.988-.098-1.975-.69-2.778-1.225-1.656-3.572-2.01-5.23-.784l-3.53 2.608c-.802.593-1.326 1.464-1.475 2.45-.15.99.097 1.975.69 2.778.498.675 1.187 1.15 1.992 1.377.4.114.633.528.52.928-.092.33-.394.547-.722.547z"
246
+ }), (0, _jsxRuntime.jsx)("path", {
247
+ d: "M7.27 22.054c-1.61 0-3.197-.735-4.225-2.125-.832-1.127-1.176-2.51-.968-3.894s.943-2.605 2.07-3.438l1.478-1.094c.334-.245.805-.175 1.05.158s.177.804-.157 1.05l-1.48 1.095c-.803.593-1.326 1.464-1.475 2.45-.148.99.097 1.975.69 2.778 1.225 1.657 3.57 2.01 5.23.785l3.528-2.608c1.658-1.225 2.01-3.57.785-5.23-.498-.674-1.187-1.15-1.992-1.376-.4-.113-.633-.527-.52-.927.112-.4.528-.63.926-.522 1.13.318 2.096.986 2.794 1.932 1.717 2.324 1.224 5.612-1.1 7.33l-3.53 2.608c-.933.693-2.023 1.026-3.105 1.026z"
248
+ })]
249
+ })
250
+ }), baseDomain(url || '')]
251
+ })]
252
+ })]
253
+ })
254
+ });
255
+ }
256
+ /**
257
+ * Renders the footer section of a single tweet, showing (non-functioning) reply, retweet, etc buttons.
258
+ *
259
+ * @returns {import('react').Element} The footer.
260
+ */
261
+
262
+
263
+ renderFooter() {
264
+ return (0, _jsxRuntime.jsxs)("div", {
265
+ className: "twitter-preview__footer",
266
+ children: [(0, _jsxRuntime.jsx)("span", {
267
+ className: "twitter-preview__icon-replies",
268
+ children: (0, _jsxRuntime.jsx)("svg", {
269
+ viewBox: "0 0 24 24",
270
+ children: (0, _jsxRuntime.jsx)("path", {
271
+ d: "M14.046 2.242l-4.148-.01h-.002c-4.374 0-7.8 3.427-7.8 7.802 0 4.098 3.186 7.206 7.465 7.37v3.828c0 .108.044.286.12.403.142.225.384.347.632.347.138 0 .277-.038.402-.118.264-.168 6.473-4.14 8.088-5.506 1.902-1.61 3.04-3.97 3.043-6.312v-.017c-.006-4.367-3.43-7.787-7.8-7.788zm3.787 12.972c-1.134.96-4.862 3.405-6.772 4.643V16.67c0-.414-.335-.75-.75-.75h-.396c-3.66 0-6.318-2.476-6.318-5.886 0-3.534 2.768-6.302 6.3-6.302l4.147.01h.002c3.532 0 6.3 2.766 6.302 6.296-.003 1.91-.942 3.844-2.514 5.176z"
272
+ })
273
+ })
274
+ }), (0, _jsxRuntime.jsx)("span", {
275
+ className: "twitter-preview__icon-retweets",
276
+ children: (0, _jsxRuntime.jsx)("svg", {
277
+ viewBox: "0 0 24 24",
278
+ children: (0, _jsxRuntime.jsx)("path", {
279
+ d: "M23.77 15.67c-.292-.293-.767-.293-1.06 0l-2.22 2.22V7.65c0-2.068-1.683-3.75-3.75-3.75h-5.85c-.414 0-.75.336-.75.75s.336.75.75.75h5.85c1.24 0 2.25 1.01 2.25 2.25v10.24l-2.22-2.22c-.293-.293-.768-.293-1.06 0s-.294.768 0 1.06l3.5 3.5c.145.147.337.22.53.22s.383-.072.53-.22l3.5-3.5c.294-.292.294-.767 0-1.06zm-10.66 3.28H7.26c-1.24 0-2.25-1.01-2.25-2.25V6.46l2.22 2.22c.148.147.34.22.532.22s.384-.073.53-.22c.293-.293.293-.768 0-1.06l-3.5-3.5c-.293-.294-.768-.294-1.06 0l-3.5 3.5c-.294.292-.294.767 0 1.06s.767.293 1.06 0l2.22-2.22V16.7c0 2.068 1.683 3.75 3.75 3.75h5.85c.414 0 .75-.336.75-.75s-.337-.75-.75-.75z"
280
+ })
281
+ })
282
+ }), (0, _jsxRuntime.jsx)("span", {
283
+ className: "twitter-preview__icon-likes",
284
+ children: (0, _jsxRuntime.jsx)("svg", {
285
+ viewBox: "0 0 24 24",
286
+ children: (0, _jsxRuntime.jsx)("path", {
287
+ d: "M12 21.638h-.014C9.403 21.59 1.95 14.856 1.95 8.478c0-3.064 2.525-5.754 5.403-5.754 2.29 0 3.83 1.58 4.646 2.73.814-1.148 2.354-2.73 4.645-2.73 2.88 0 5.404 2.69 5.404 5.755 0 6.376-7.454 13.11-10.037 13.157H12zM7.354 4.225c-2.08 0-3.903 1.988-3.903 4.255 0 5.74 7.034 11.596 8.55 11.658 1.518-.062 8.55-5.917 8.55-11.658 0-2.267-1.823-4.255-3.903-4.255-2.528 0-3.94 2.936-3.952 2.965-.23.562-1.156.562-1.387 0-.014-.03-1.425-2.965-3.954-2.965z"
288
+ })
289
+ })
290
+ }), (0, _jsxRuntime.jsx)("span", {
291
+ className: "twitter-preview__icon-share",
292
+ children: (0, _jsxRuntime.jsxs)("svg", {
293
+ viewBox: "0 0 24 24",
294
+ children: [(0, _jsxRuntime.jsx)("path", {
295
+ d: "M17.53 7.47l-5-5c-.293-.293-.768-.293-1.06 0l-5 5c-.294.293-.294.768 0 1.06s.767.294 1.06 0l3.72-3.72V15c0 .414.336.75.75.75s.75-.336.75-.75V4.81l3.72 3.72c.146.147.338.22.53.22s.384-.072.53-.22c.293-.293.293-.767 0-1.06z"
296
+ }), (0, _jsxRuntime.jsx)("path", {
297
+ d: "M19.708 21.944H4.292C3.028 21.944 2 20.916 2 19.652V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 .437.355.792.792.792h15.416c.437 0 .792-.355.792-.792V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 1.264-1.028 2.292-2.292 2.292z"
298
+ })]
299
+ })
300
+ })]
301
+ });
302
+ }
303
+
304
+ render() {
305
+ const {
306
+ isLast,
307
+ profileImage,
308
+ name,
309
+ screenName,
310
+ date,
311
+ text,
312
+ media,
313
+ tweet,
314
+ urls,
315
+ card
316
+ } = this.props;
317
+ return (0, _jsxRuntime.jsxs)("div", {
318
+ className: "twitter-preview__container",
319
+ children: [this.renderSidebar(profileImage, isLast), (0, _jsxRuntime.jsxs)("div", {
320
+ className: "twitter-preview__main",
321
+ children: [this.renderHeader(name, screenName, date), (0, _jsxRuntime.jsxs)("div", {
322
+ className: "twitter-preview__content",
323
+ children: [this.renderText(text, urls, card), this.renderMedia(media), this.renderQuoteTweet(tweet), this.renderCard(card)]
324
+ }), this.renderFooter()]
325
+ })]
326
+ });
327
+ }
328
+
329
+ }
330
+
331
+ exports.Tweet = Tweet;
332
+ Tweet.propTypes = {
333
+ tweets: _propTypes.default.array,
334
+ isLast: _propTypes.default.bool,
335
+ profileImage: _propTypes.default.string,
336
+ name: _propTypes.default.string,
337
+ screenName: _propTypes.default.string,
338
+ date: _propTypes.default.number,
339
+ text: _propTypes.default.string,
340
+ media: _propTypes.default.array,
341
+ tweet: _propTypes.default.string,
342
+ urls: _propTypes.default.array,
343
+ card: _propTypes.default.object
344
+ };
345
+ var _default = Tweet;
346
+ exports.default = _default;