@social-mail/social-mail-client 1.2.737 → 1.2.739

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.2.737",
3
+ "version": "1.2.739",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,6 +29,7 @@ declare global {
29
29
  grid-template-rows: auto auto 1fr auto;
30
30
 
31
31
  padding-bottom: 10px;
32
+ padding-right: 20px;
32
33
 
33
34
  border-bottom: solid 1px lightgray;
34
35
 
@@ -6,15 +6,99 @@ import { DateFormats } from "../../common/date/DateFormats";
6
6
  import { UMD } from "@web-atoms/core/dist/core/types";
7
7
  import { renderMail } from "../../web/page/mails/service/ConversationService";
8
8
  import MediaCarousel from "./controls/MediaCarousel";
9
+ import styled from "@web-atoms/core/dist/style/styled";
9
10
 
10
11
  declare global {
11
12
  namespace JSX {
12
13
  interface IntrinsicElements {
13
14
  "share-button": any;
15
+ "post-view": any;
14
16
  }
15
17
  }
16
18
  }
17
19
 
20
+ styled.css `
21
+ display: grid;
22
+ grid-template-columns: 1fr auto;
23
+ grid-template-rows: auto auto auto 1fr auto auto auto;
24
+
25
+ padding-top: 10px;
26
+ padding-bottom: 10px;
27
+
28
+ row-gap: 10px;
29
+
30
+ & > [data-element=author] {
31
+ grid-row: 1;
32
+ grid-column: 1;
33
+ margin: 0;
34
+ font-weight: normal;
35
+ font-size: 0.8rem;
36
+ line-height: 1;
37
+ letter-spacing: 0.05rem;
38
+ }
39
+
40
+ & > [data-element=date] {
41
+ grid-row: 1;
42
+ grid-column: 2;
43
+ margin: 0;
44
+ font-weight: normal;
45
+ font-size: 0.8rem;
46
+ line-height: 1;
47
+ letter-spacing: 0.05rem;
48
+ }
49
+
50
+ & > [data-element=title] {
51
+ grid-row: 2;
52
+ grid-column: 1 / span 2;
53
+ margin: 0;
54
+ font-weight: normal;
55
+ font-size: 1.65rem;
56
+ line-height: 1.2;
57
+ }
58
+
59
+ & > [data-element=media] {
60
+ grid-row: 3;
61
+ grid-column: 1/ span 2;
62
+ display: grid;
63
+ background-color: #343a400d;
64
+ border-radius: 20px;
65
+ overflow: hidden;
66
+ & img, & video {
67
+ max-height: 70vh;
68
+ }
69
+ & [data-element=preview] {
70
+ display: grid;
71
+ width: 100%;
72
+ & > * {
73
+ place-self: center;
74
+ max-width: 100%;
75
+ }
76
+ }
77
+ & > carousel-slider {
78
+ place-self: stretch;
79
+ }
80
+ }
81
+
82
+ &[has-poster] > [data-element=media] {
83
+ grid-row: 5;
84
+ grid-column: 1 / span 3;
85
+ }
86
+
87
+ & > [data-element=content] {
88
+ grid-row: 4;
89
+ grid-column: 1 / span 2;
90
+ }
91
+
92
+ & > footer {
93
+ grid-row: 6;
94
+ }
95
+
96
+ & > [data-element=comments] {
97
+ grid-row: 7;
98
+ }
99
+
100
+ `.installGlobal("post-view");
101
+
18
102
  const commentIcon = "💬";
19
103
 
20
104
  export default function PostView ({
@@ -26,7 +110,7 @@ export default function PostView ({
26
110
 
27
111
  const isComment = email.parentID !== null;
28
112
 
29
- return <section
113
+ return <post-view
30
114
  data-element="blog-item"
31
115
  data-comment={isComment}
32
116
  data-item-path={itemPath}
@@ -36,7 +120,7 @@ export default function PostView ({
36
120
  <label text={ isComment ? email.senderName : email.subject}/>
37
121
  </h4>
38
122
  <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
39
- {!isComment && <h5 text={email.senderName}/> }
123
+ {!isComment && <h5 data-element="author" text={email.senderName}/> }
40
124
  <section
41
125
  data-element="content">
42
126
  { !email.parentID
@@ -82,5 +166,5 @@ export default function PostView ({
82
166
  { ... (email.children ?? []).map((c, i) => <PostView itemPath={ `${ itemPath ? itemPath : "$" }.children.${i}` } email={c} />) }
83
167
  </section>
84
168
 
85
- </section>;
169
+ </post-view>;
86
170
  }
@@ -22,22 +22,28 @@ export default function MediaCarousel({ email = void 0 as IEmail}) {
22
22
  }
23
23
  }
24
24
 
25
- const children = [] as XNode[];
25
+ let children = [] as XNode[];
26
26
 
27
27
  for (const element of email.attachments) {
28
28
  if (/video/i.test(element.contentType)) {
29
- children.push(<video controls="true" src={element.url} />);
29
+ children.push(<div data-element="preview"><video controls="true" src={element.url} /></div>);
30
30
  continue;
31
31
  }
32
32
  if (/image/i.test(element.contentType)) {
33
- children.push(<img src={element.url} />);
33
+ children.push(<div data-element="preview"><img src={element.url} /></div>);
34
34
  continue;
35
35
  }
36
36
  }
37
37
 
38
38
  if (children.length) {
39
- return XNode.create("carousel-slider", {}, ... children);
39
+ if (children.length > 1) {
40
+ children = [XNode.create("carousel-slider", {
41
+ "data-element": "media"
42
+ }, ... children)];
43
+ }
44
+ return <div data-element="media">{children[0]}</div>;
40
45
  }
41
46
 
42
- return <div/>;
47
+ return <div data-element="media"/>;
48
+
43
49
  }