@pareto-engineering/design-system 2.0.0-alpha.13 → 2.0.0-alpha.14

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.
@@ -25,7 +25,7 @@ export const Base = () => {
25
25
  from :'theirs',
26
26
  },
27
27
  {
28
- message:'Hi Humbl, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
28
+ message:'Hi Morgan! Here is the database we prepared for you.',
29
29
  sender :'CAMILLE',
30
30
  from :'ours',
31
31
  },
@@ -34,6 +34,83 @@ export const Base = () => {
34
34
  sender :'HUMBL',
35
35
  from :'theirs',
36
36
  },
37
+ {
38
+ message:'Hi Morgan! Here is the database we prepared for you.',
39
+ sender :'CAMILLE',
40
+ from :'ours',
41
+ },
42
+ ]
43
+
44
+ return (
45
+ <Conversation>
46
+ {conversations.map((conversation) => (
47
+ <Conversation.Message key={conversation.message} {...conversation} />
48
+ ))}
49
+ </Conversation>
50
+ )
51
+ }
52
+
53
+ export const WithTriangle = () => {
54
+ const conversations = [
55
+ {
56
+ message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
57
+ sender :'HUMBL',
58
+ from :'theirs',
59
+ },
60
+ {
61
+ message:'Hi Morgan! Here is the database we prepared for you.',
62
+ sender :'CAMILLE',
63
+ from :'ours',
64
+ },
65
+ {
66
+ message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
67
+ sender :'HUMBL',
68
+ from :'theirs',
69
+ },
70
+ {
71
+ message:'Hi Morgan! Here is the database we prepared for you.',
72
+ sender :'CAMILLE',
73
+ from :'ours',
74
+ },
75
+ ]
76
+
77
+ return (
78
+ <Conversation
79
+ hasTriangle
80
+ >
81
+ {conversations.map((conversation) => (
82
+ <Conversation.Message key={conversation.message} {...conversation} />
83
+ ))}
84
+ </Conversation>
85
+ )
86
+ }
87
+
88
+ export const WithAttachment = () => {
89
+ const conversations = [
90
+ {
91
+ message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
92
+ sender :'HUMBL',
93
+ from :'theirs',
94
+ },
95
+ {
96
+ message :'Hi Morgan! Here is the database we prepared for you.',
97
+ sender :'CAMILLE',
98
+ from :'ours',
99
+ attachment :'spreadsheet.xlsx',
100
+ attachmentColor:'main4',
101
+ },
102
+ {
103
+ message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
104
+ sender :'HUMBL',
105
+ from :'theirs',
106
+ },
107
+ {
108
+ message :'Hi Morgan! Here is the database we prepared for you.',
109
+ sender :'CAMILLE',
110
+ from :'ours',
111
+ attachment :'spreadsheet.xlsx',
112
+ attachmentColor:'main4',
113
+ },
37
114
  ]
38
115
 
39
116
  return (
@@ -5,11 +5,11 @@
5
5
  position: absolute;
6
6
  top: 0;
7
7
  left: 0;
8
- justify-content: var(--vertical-align);
9
8
  width: 100%;
10
9
  height: var(--gradient-height);
11
10
  background-image: linear-gradient(transparent, var(--y) 25%, var(--light-y) 75%, transparent);
12
- opacity: .8;
11
+ opacity: .4;
12
+ z-index: -1;
13
13
  }
14
14
 
15
15
 
@@ -28,19 +28,19 @@ const Conversation = ({
28
28
  ourColor,
29
29
  theirColor,
30
30
  children,
31
+ hasTriangle,
31
32
  // ...otherProps
32
33
  }) => {
33
34
  useLayoutEffect(() => {
34
35
  import('./styles.scss')
35
36
  }, [])
36
37
 
37
- // const messageColors = { ours: color, theirs: 'main2' }
38
-
39
38
  return (
40
39
  <ConversationContext.Provider
41
40
  value={{
42
41
  ourColor,
43
42
  theirColor,
43
+ hasTriangle,
44
44
  }}
45
45
  >
46
46
  <div
@@ -76,11 +76,13 @@ Conversation.propTypes = {
76
76
  /**
77
77
  * The React-written, css properties for this element.
78
78
  */
79
- style :PropTypes.objectOf(PropTypes.string),
79
+ style:PropTypes.objectOf(PropTypes.string),
80
+
80
81
  /**
81
82
  * The base color to our messages component
82
83
  */
83
- ourColor :PropTypes.string,
84
+ ourColor:PropTypes.string,
85
+
84
86
  /**
85
87
  * The base color to their messages component
86
88
  */
@@ -94,12 +96,18 @@ Conversation.propTypes = {
94
96
  * The children JSX
95
97
  */
96
98
  children :PropTypes.node,
99
+
100
+ /**
101
+ * whether to add triangle to bubble chats
102
+ */
103
+ hasTriangle:PropTypes.bool,
97
104
  }
98
105
 
99
106
  Conversation.defaultProps = {
100
- backgroundColor:'background',
101
- ourColor :'main2',
102
- theirColor :'background2',
107
+ backgroundColor:'background2',
108
+ ourColor :'background1',
109
+ theirColor :'background1',
110
+ hasTriangle :'false',
103
111
  }
104
112
 
105
113
  Conversation.Message = Message
@@ -23,9 +23,12 @@ const Message = ({
23
23
  message,
24
24
  sender,
25
25
  from,
26
+ attachment,
27
+ attachmentIcon,
28
+ attachmentColor,
26
29
  // ...otherProps
27
30
  }) => {
28
- const { ourColor, theirColor } = useConversation()
31
+ const { hasTriangle, ourColor, theirColor } = useConversation()
29
32
 
30
33
  return (
31
34
  <div
@@ -36,6 +39,8 @@ const Message = ({
36
39
  userClassName,
37
40
  `x-${from === 'ours' ? ourColor : theirColor}`,
38
41
  from === 'ours' && 'ours',
42
+ hasTriangle === true ? 'has-triangle' : '',
43
+ 'v1',
39
44
  ]
40
45
  .filter((e) => e)
41
46
  .join(' ')}
@@ -49,11 +54,19 @@ const Message = ({
49
54
  <p>
50
55
  {message}
51
56
  </p>
57
+ {attachment
58
+ && (
59
+ <div className={`attachment y-${attachmentColor}`}>
60
+ <span className="f-icons">{attachmentIcon}</span>
61
+ <p className="ml-v">
62
+ {attachment}
63
+ </p>
64
+ </div>
65
+ )}
52
66
  </div>
53
67
  </div>
54
68
  )
55
69
  }
56
-
57
70
  Message.propTypes = {
58
71
  /**
59
72
  * The HTML id for this element
@@ -65,26 +78,46 @@ Message.propTypes = {
65
78
  */
66
79
  className:PropTypes.string,
67
80
 
81
+ /**
82
+ * The React-written, css properties for this element.
83
+ */
84
+ style:PropTypes.objectOf(PropTypes.string),
85
+
68
86
  /**
69
87
  * The message in the conversation
70
88
  */
71
89
  message:PropTypes.string.isRequired,
90
+
72
91
  /**
73
92
  * The sender of the message
74
93
  */
75
- sender :PropTypes.string.isRequired,
94
+ sender:PropTypes.string.isRequired,
95
+
76
96
  /**
77
97
  * The owner of the message
78
98
  */
79
- from :PropTypes.oneOf(['ours', 'theirs']),
99
+ from:PropTypes.oneOf(['ours', 'theirs']),
100
+
80
101
  /**
81
- * The React-written, css properties for this element.
102
+ * name of the attachment file
103
+ */
104
+ attachment:PropTypes.string,
105
+
106
+ /**
107
+ * source of the attachment icon
108
+ */
109
+ attachmentIcon:PropTypes.string,
110
+
111
+ /**
112
+ * background color of the attachment box
82
113
  */
83
- style :PropTypes.objectOf(PropTypes.string),
114
+ attachmentColor:PropTypes.string,
84
115
  }
85
116
 
86
117
  Message.defaultProps = {
87
- from:'theirs',
118
+ from :'theirs',
119
+ attachmentIcon :'A',
120
+ attachmentColor:'main4',
88
121
  }
89
122
 
90
123
  export default Message
@@ -1,4 +1,5 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
+
2
3
  @use "@pareto-engineering/bem";
3
4
  @use "@aztlan/stylebook/src/mixins";
4
5
  @use "@aztlan/stylebook/src/globals" as *;
@@ -8,47 +9,153 @@ $default-conversation-background: var(--y);
8
9
  $default-message-max-width: calc(100% - #{$default-padding});
9
10
  $default-message-min-width: 12em;
10
11
  $default-message-border: var(--theme-border);
12
+ $triangle-border-size: 15px;
13
+ $triangle-border-style: $triangle-border-size solid;
14
+ $triangle-border-style-subtracted: ($triangle-border-size - 1px) solid;
15
+ $triangle-border1: $triangle-border-style var(--paragraph);
16
+ $triangle-border2: $triangle-border-style transparent;
17
+ $triangle-border3: $triangle-border-style-subtracted var(--x);
18
+ $triangle-border4: $triangle-border-style-subtracted transparent;
19
+ $triangle-before-side:24px;
20
+ $triangle-before-bottom:-30px;
21
+ $triangle-after-bottom:-27px;
22
+ $triangle-after-side:25px;
11
23
 
12
24
  .#{bem.$base}.conversation {
13
- display: flex;
14
- flex-direction: column;
15
- background-color: $default-conversation-background;
16
- padding: $default-padding;
25
+ background-color: $default-conversation-background;
26
+ border-radius: var(--theme-border-radius);
27
+ display: flex;
28
+ flex-direction: column;
29
+ padding: $default-padding;
30
+
31
+ >:not(:last-child) {
32
+ margin-bottom: $default-padding;
33
+ }
34
+
35
+ // >:nth-child(1) {
36
+ // animation-delay: 1s;
37
+ // }
38
+ // >:nth-child(2) {
39
+ // animation-delay: 3s;
40
+ // }
41
+
42
+ .#{bem.$base}.message {
43
+ align-self: flex-start;
44
+ background-color: var(--x);
45
+ // animation: fadeIn 1s ease-in both;
46
+ border: $default-message-border;
17
47
  border-radius: var(--theme-border-radius);
48
+ max-width: $default-message-max-width;
49
+ min-width: $default-message-min-width;
50
+ padding: $default-padding;
51
+ position: relative;
18
52
 
19
- >:not(:last-child) {
20
- margin-bottom: $default-padding;
21
- }
53
+ .#{bem.$element-content} {
54
+ display: flex;
55
+ flex-direction: column;
56
+
57
+ >p {
58
+ color: var(--on-x);
59
+ }
60
+
61
+ .sender {
62
+ font-weight: 800;
63
+ margin-bottom: .5em;
64
+ }
22
65
 
23
- .#{bem.$base}.message {
24
- min-width: $default-message-min-width;
25
- max-width: $default-message-max-width;
26
- padding: $default-padding;
27
- border-radius: var(--theme-border-radius);
28
- background-color: var(--x);
29
- align-self: flex-start;
30
- border: $default-message-border;
31
-
32
- .#{bem.$element-content} {
33
- display: flex;
34
- flex-direction: column;
35
-
36
- >p {
37
- color: var(--on-x);
38
- }
39
-
40
- .sender {
41
- font-weight: 800;
42
- margin-bottom: .5em;
43
- }
66
+ .attachment {
67
+ align-self: baseline;
68
+ background-color: var(--y);
69
+ display: flex;
70
+ flex-direction: row;
71
+ padding: .5em 1em;
72
+
73
+ > p {
74
+ margin-bottom: 0;
44
75
  }
45
- }
46
76
 
47
- .#{bem.$base}.ours {
48
- align-self: flex-end;
77
+ > img {
78
+ width: 40px;
79
+ }
80
+ }
81
+ }
82
+ &.#{bem.$base}.ours {
83
+ align-self: flex-end;
49
84
  }
50
85
 
51
- }
86
+ &.has-triangle {
87
+ ::before {
88
+ border-bottom: $triangle-border2;
89
+ border-left: $triangle-border2;
90
+ border-right: $triangle-border1;
91
+ border-top: $triangle-border1;
92
+ bottom: $triangle-before-bottom;
93
+ content: "";
94
+ height: 0;
95
+ position: absolute;
96
+ right: $triangle-before-side;
97
+ width: 0;
98
+ }
99
+
100
+ ::after {
101
+ border-bottom: $triangle-border4;
102
+ border-left: $triangle-border4;
103
+ border-right: $triangle-border3;
104
+ border-top: $triangle-border3;
105
+ bottom: $triangle-after-bottom;
106
+ content: "";
107
+ height: 0;
108
+ position: absolute;
109
+ right: $triangle-after-side;
110
+ width: 0;
111
+ }
112
+
113
+ &:not(.ours) {
114
+ ::before {
115
+ border-bottom: $triangle-border2;
116
+ border-left: $triangle-border1;
117
+ border-right: $triangle-border2;
118
+ border-top: $triangle-border1;
119
+ bottom: $triangle-before-bottom;
120
+ content: "";
121
+ height: 0;
122
+ left: $triangle-before-side;
123
+ position: absolute;
124
+ width: 0;
125
+ }
52
126
 
127
+ ::after {
128
+ border-bottom: $triangle-border4;
129
+ border-left: $triangle-border3;
130
+ border-right: $triangle-border4;
131
+ border-top: $triangle-border3;
132
+ bottom: $triangle-after-bottom;
133
+ content: "";
134
+ height: 0;
135
+ left: $triangle-after-side;
136
+ position: absolute;
137
+ width: 0;
138
+ }
139
+ }
140
+ }
53
141
 
142
+ // mobile style
143
+ @include mixins.media($to:$sm-md) {
144
+ .message {
145
+ margin-top: 2em;
146
+ }
147
+ }
148
+ }
149
+ }
54
150
 
151
+ //@keyframes fadeIn {
152
+ // from {
153
+ // opacity: 0;
154
+ // transform: translate3d(0, 50%, 0);
155
+ // }
156
+ //
157
+ // to {
158
+ // opacity: 1;
159
+ // transform: translate3d(0, 0, 0);
160
+ // }
161
+ //}
@@ -13,24 +13,23 @@ $default-margin:.5em;
13
13
  border: transparent;
14
14
  border-radius: var(--theme-border-radius);
15
15
  color: var(--on-x, var(--on-#{$default-color}));
16
+ display: inline-flex;
16
17
  font-weight: 600;
18
+ font-family: var(--theme-default-paragraph);
19
+ justify-content: space-between;
17
20
  padding: $default-padding;
18
21
  transition: all .25s;
19
22
 
20
- &.arrow-right{
23
+ &.arrow-right {
21
24
  &::after {
22
- content: "L";
23
- font-family: "icons";
24
- vertical-align: middle;
25
+ content: "-->";
25
26
  margin-left: $default-margin;
26
27
  }
27
28
  }
28
29
 
29
- &.arrow-left{
30
+ &.arrow-left {
30
31
  &::before {
31
- content: "H";
32
- font-family: "icons";
33
- vertical-align: middle;
32
+ content: "<--";
34
33
  margin-right: $default-margin;
35
34
  }
36
35
  }
@@ -41,6 +40,7 @@ $default-margin:.5em;
41
40
  &:hover {
42
41
  background: var(--light-x, var(--light-#{$default-color}));
43
42
  }
43
+
44
44
  &:focus {
45
45
  background: var(--dark-x, var(--dark-#{$default-color}));
46
46
  }
@@ -58,7 +58,7 @@ $default-margin:.5em;
58
58
 
59
59
  &:hover,
60
60
  &:focus,
61
- &:disabled{
61
+ &:disabled {
62
62
  background: transparent;
63
63
  }
64
64
 
@@ -74,7 +74,7 @@ $default-margin:.5em;
74
74
  }
75
75
  }
76
76
 
77
- &:disabled{
77
+ &:disabled {
78
78
  border: 1px solid var(--x, var(--#{$default-color}));
79
79
  color: var(--x, var(--#{$default-color}));
80
80
  }
@@ -83,8 +83,8 @@ $default-margin:.5em;
83
83
  &.#{bem.$modifier-simple} {
84
84
  background: transparent;
85
85
  border: 1px solid transparent;
86
- padding: 0;
87
86
  color: var(--x, var(--#{$default-color}));
87
+ padding: 0;
88
88
 
89
89
  &:disabled,
90
90
  &:hover,
@@ -93,13 +93,13 @@ $default-margin:.5em;
93
93
  }
94
94
 
95
95
  &:not(:disabled) {
96
- &:hover {
97
- color: var(--light-x, var(--light-#{$default-color}));
98
- }
96
+ &:hover {
97
+ color: var(--light-x, var(--light-#{$default-color}));
98
+ }
99
99
 
100
- &:focus {
101
- color: var(--dark-x, var(--dark-#{$default-color}));
102
- }
100
+ &:focus {
101
+ color: var(--dark-x, var(--dark-#{$default-color}));
102
+ }
103
103
  }
104
104
 
105
105
  &:disabled {