@@ -31,7 +31,8 @@ const ChatBox = () => {
31
31
chatContainer . scrollTop = chatContainer . scrollHeight ;
32
32
33
33
// Set scrollLeft to the maximum value to keep the scroll bar at the right
34
- chatContainer . scrollLeft = chatContainer . scrollWidth - chatContainer . clientWidth ;
34
+ chatContainer . scrollLeft =
35
+ chatContainer . scrollWidth - chatContainer . clientWidth ;
35
36
}
36
37
} , [ chat ] ) ;
37
38
@@ -60,20 +61,29 @@ const ChatBox = () => {
60
61
backgroundColor : "gray.100" ,
61
62
borderRadius : "md" ,
62
63
padding : "10px" ,
63
- width : "100%" // Use 100% width
64
+ width : "100%" , // Use 100% width
64
65
} }
65
66
>
66
67
{ chat . map ( ( entry , i ) => (
67
68
< HStack
68
69
w = "100%"
69
- justifyContent = { entry . nickname === user ?. username ? "flex-end" : "flex-start" } // Align based on the sender
70
+ justifyContent = {
71
+ entry . nickname === user ?. username ? "flex-end" : "flex-start"
72
+ } // Align based on the sender
70
73
key = { i }
71
74
>
72
75
{ entry . nickname !== user ?. username && (
73
- < Avatar name = { entry . nickname } w = "40px" h = "40px" />
76
+ < Avatar
77
+ name = { entry . nickname }
78
+ w = "40px"
79
+ h = "40px"
80
+ alignSelf = "flex-start"
81
+ />
74
82
) }
75
83
< Text
76
- backgroundColor = { entry . nickname === user ?. username ? "blue.400" : "gray.200" }
84
+ backgroundColor = {
85
+ entry . nickname === user ?. username ? "blue.400" : "gray.200"
86
+ }
77
87
color = { entry . nickname === user ?. username ? "white" : "black" }
78
88
borderRadius = "lg"
79
89
paddingX = { 2 }
@@ -87,7 +97,12 @@ const ChatBox = () => {
87
97
{ entry . msg }
88
98
</ Text >
89
99
{ entry . nickname === user ?. username && (
90
- < Avatar name = { entry . nickname } w = "40px" h = "40px" />
100
+ < Avatar
101
+ name = { entry . nickname }
102
+ w = "40px"
103
+ h = "40px"
104
+ alignSelf = "flex-start"
105
+ />
91
106
) }
92
107
</ HStack >
93
108
) ) }
0 commit comments