Skip to content

Commit 477f605

Browse files
committed
feat: sync 2.4.2
1 parent 72d6992 commit 477f605

File tree

25 files changed

+229
-168
lines changed

25 files changed

+229
-168
lines changed

src/components/Bubble/style.less

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
background: @bubble-left-bg;
66
border-radius: @bubble-left-border-radius;
77

8-
&.text {
8+
&.text,
9+
&.typing {
910
min-width: 40px;
1011
padding: @bubble-text-padding;
1112
box-sizing: border-box;
@@ -23,9 +24,6 @@
2324
border-radius: inherit;
2425
}
2526
}
26-
&.typing {
27-
padding: @bubble-typing-padding;
28-
}
2927
p {
3028
margin: 0;
3129
}

src/components/Button/style.less

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
color: var(--btn-primary-color);
4545

4646
&:active {
47-
background: @btn-primary-active-bg;
47+
// background: @btn-primary-active-bg;
48+
opacity: 0.8;
4849
}
4950
}
5051
&--outline&--primary {
@@ -80,7 +81,8 @@
8081
}
8182
&--primary:not(.Btn--outline) {
8283
&:hover {
83-
background: @btn-primary-hover-bg;
84+
background: var(--btn-primary-bg);
85+
opacity: 0.9;
8486
}
8587
}
8688
}

src/components/Card/Card.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type CardSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
66
export interface CardProps {
77
className?: string;
88
size?: CardSize;
9-
fluid?: boolean;
9+
fluid?: boolean | 'order';
1010
children?: React.ReactNode;
1111
}
1212

@@ -16,6 +16,7 @@ export const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) =>
1616
return (
1717
<div
1818
className={clsx('Card', size && `Card--${size}`, { 'Card--fluid': fluid }, className)}
19+
data-fluid={fluid}
1920
{...other}
2021
ref={ref}
2122
>

src/components/Card/style.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
}
2626
}
2727

28+
.Card[data-fluid="order"] {
29+
max-width: 360px;
30+
}
31+
2832
/* CardMedia */
2933
.CardMedia {
3034
position: relative;

src/components/Chat/style.less

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -44,51 +44,3 @@
4444
padding-bottom: var(--safe-bottom);
4545
background: var(--gray-7);
4646
}
47-
48-
.slide-in-right-item {
49-
animation: slideInRight 0.5s ease-in-out both;
50-
}
51-
52-
.slide-in-right-item {
53-
&:nth-child(2) {
54-
animation-delay: 0.2s;
55-
}
56-
&:nth-child(3) {
57-
animation-delay: 0.4s;
58-
}
59-
&:nth-child(4) {
60-
animation-delay: 0.6s;
61-
}
62-
&:nth-child(5) {
63-
animation-delay: 0.8s;
64-
}
65-
&:nth-child(6) {
66-
animation-delay: 1s;
67-
}
68-
&:nth-child(7) {
69-
animation-delay: 1.2s;
70-
}
71-
&:nth-child(8) {
72-
animation-delay: 1.4s;
73-
}
74-
&:nth-child(9) {
75-
animation-delay: 1.6s;
76-
}
77-
&:nth-child(10) {
78-
animation-delay: 1.8s;
79-
}
80-
&:nth-child(11) {
81-
animation-delay: 2s;
82-
}
83-
}
84-
85-
@keyframes slideInRight {
86-
0% {
87-
transform: translateX(100px);
88-
opacity: 0;
89-
}
90-
100% {
91-
transform: translateX(0);
92-
opacity: 1;
93-
}
94-
}

src/components/Composer/style.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
border: @composer-input-border;
4040
border-radius: @composer-input-border-radius;
4141
background: @composer-input-bg;
42-
line-height: (20 / 14);
43-
word-break: break-all;
42+
line-height: 20px;
43+
font-size: 15px;
4444
caret-color: @composer-input-caret-color;
4545
transition: @composer-input-transition;
4646
}

src/components/LocaleProvider/locales/ar_EG.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
export default {
2+
BackBottom: {
3+
newMsgOne: '{n} رسالة جديدة',
4+
newMsgOther: '{n} رسالة جديدة',
5+
bottom: 'الأسفل',
6+
},
27
Time: {
38
weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
49
formats: {
@@ -8,4 +13,25 @@ export default {
813
YT: 'HH:mm أمس',
914
},
1015
},
16+
Composer: {
17+
send: 'إرسال',
18+
},
19+
SendConfirm: {
20+
title: 'إرسال صورة',
21+
send: 'أرسل',
22+
cancel: 'إلغاء',
23+
},
24+
RateActions: {
25+
up: 'التصويت',
26+
down: 'تصويت سلبي',
27+
},
28+
Recorder: {
29+
hold2talk: 'أستمر بالضغط لتتحدث',
30+
release2send: 'حرر للإرسال',
31+
releaseOrSwipe: 'حرر للإرسال ، اسحب لأعلى للإلغاء',
32+
release2cancel: 'حرر للإلغاء',
33+
},
34+
Search: {
35+
search: 'يبحث',
36+
},
1137
};
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
export default {
2+
BackBottom: {
3+
newMsgOne: '{n} nouveau message',
4+
newMsgOther: '{n} nouveau messages',
5+
bottom: 'Fond',
6+
},
27
Time: {
38
weekdays: 'Dimanche_Lundi_Mardi_Mercredi_Jeudi_Vendredi_Samedi'.split('_'),
49
formats: {
510
LT: 'HH:mm',
611
lll: 'D/M/YYYY HH:mm',
712
WT: 'dddd HH:mm',
8-
YT: 'Hier HH:mm', // TODO
13+
YT: 'Hier HH:mm',
914
},
1015
},
16+
Composer: {
17+
send: 'Envoyer',
18+
},
19+
SendConfirm: {
20+
title: 'Envoyer une photo',
21+
send: 'Envoyer',
22+
cancel: 'Annuler',
23+
},
24+
RateActions: {
25+
up: 'Voter pour',
26+
down: 'Vote négatif',
27+
},
28+
Recorder: {
29+
hold2talk: 'Tenir pour parler',
30+
release2send: 'Libérer pour envoyer',
31+
releaseOrSwipe: 'Relâchez pour envoyer, balayez vers le haut pour annuler',
32+
release2cancel: 'Relâcher pour annuler',
33+
},
34+
Search: {
35+
search: 'Chercher',
36+
},
1137
};

src/components/Message/Message.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface MessageProps {
3939
/**
4040
* 消息位置
4141
*/
42-
position?: 'left' | 'right' | 'center';
42+
position?: 'left' | 'right' | 'center' | 'pop';
4343
/**
4444
* 是否显示时间
4545
*/
@@ -56,31 +56,33 @@ export interface MessageProps {
5656

5757
const Message = (props: MessageProps) => {
5858
const { renderMessageContent = () => null, ...msg } = props;
59-
const { type, content, user, _id: id } = msg;
59+
const { type, content, user = {}, _id: id, position = 'left', hasTime = true, createdAt } = msg;
60+
const { name, avatar } = user;
6061

6162
if (type === 'system') {
6263
return <SystemMessage content={content.text} action={content.action} />;
6364
}
6465

66+
const isRL = position === 'right' || position === 'left';
67+
6568
return (
66-
<div className={clsx('Message', msg.position)} data-id={id} data-type={type}>
67-
{msg.hasTime && msg.createdAt && (
69+
<div className={clsx('Message', position)} data-id={id} data-type={type}>
70+
{hasTime && createdAt && (
6871
<div className="Message-meta">
69-
<Time date={msg.createdAt} />
72+
<Time date={createdAt} />
7073
</div>
7174
)}
72-
<div className="Message-content" role="alert" aria-live="assertive" aria-atomic="false">
73-
{user && user.avatar && <Avatar src={user.avatar} alt={user.name} url={user.url} />}
74-
{type === 'typing' ? <Typing /> : renderMessageContent(msg)}
75+
<div className="Message-main">
76+
{isRL && avatar && <Avatar src={avatar} alt={name} url={user.url} />}
77+
<div className="Message-inner">
78+
{isRL && name && <div className="Message-author">{name}</div>}
79+
<div className="Message-content" role="alert" aria-live="assertive" aria-atomic="false">
80+
{type === 'typing' ? <Typing /> : renderMessageContent(msg)}
81+
</div>
82+
</div>
7583
</div>
7684
</div>
7785
);
7886
};
7987

80-
Message.defaultProps = {
81-
user: {},
82-
position: 'left',
83-
hasTime: true,
84-
};
85-
8688
export default React.memo(Message);

src/components/Message/style.less

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
1+
@avatar-gap: 4px;
2+
13
.Message {
24
position: relative;
35

46
& + & {
57
margin-top: @message-spacer-y;
68
}
79
&.left {
8-
animation: msgLeft 0.5s ease-in-out;
9-
10+
.Message-main {
11+
& > .Avatar {
12+
margin-right: @avatar-gap;
13+
}
14+
}
1015
.Bubble {
1116
margin-right: @bubble-left-gutter;
1217
}
1318
}
1419
&.right {
15-
animation: msgRight 0.5s ease-in-out;
16-
20+
.Message-main,
1721
.Message-content {
1822
flex-direction: row-reverse;
19-
23+
}
24+
.Message-main {
2025
& > .Avatar {
21-
margin-right: 0;
22-
margin-left: 4px;
26+
margin-left: @avatar-gap;
2327
}
2428
}
29+
.Message-author {
30+
text-align: right;
31+
}
2532
.Bubble {
2633
margin-left: @bubble-right-gutter;
2734
border-radius: @bubble-right-border-radius;
2835
background: @bubble-right-bg;
2936
}
3037
}
38+
&.pop {
39+
display: none;
40+
}
3141
}
3242

3343
.Message-meta {
@@ -37,14 +47,22 @@
3747
text-align: center;
3848
}
3949

50+
.Message-main,
4051
.Message-content {
4152
display: flex;
4253
align-items: flex-start;
54+
}
4355

44-
& > .Avatar {
45-
flex-shrink: 0;
46-
margin-right: 4px;
47-
}
56+
.Message-inner {
57+
flex: 1;
58+
min-width: 0;
59+
}
60+
61+
.Message-author {
62+
margin-bottom: 6px;
63+
color: var(--gray-2);
64+
font-size: var(--font-size-xs);
65+
line-height: 1.1;
4866
}
4967

5068
// SystemMessage
@@ -66,33 +84,3 @@
6684
background: var(--gray-8);
6785
text-align: left;
6886
}
69-
70-
@keyframes msgLeft {
71-
0% {
72-
transform: translateX(-20px);
73-
opacity: 0;
74-
}
75-
50% {
76-
transform: translateX(-20px);
77-
opacity: 0;
78-
}
79-
to {
80-
transform: translateX(0);
81-
opacity: 1;
82-
}
83-
}
84-
85-
@keyframes msgRight {
86-
0% {
87-
transform: translateX(20px);
88-
opacity: 0;
89-
}
90-
20% {
91-
transform: translateX(20px);
92-
opacity: 0;
93-
}
94-
to {
95-
transform: translateX(0);
96-
opacity: 1;
97-
}
98-
}

0 commit comments

Comments
 (0)