Katheryne/Frontend/Shared/MessageBubble.razor

60 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-10-07 18:55:22 +08:00
@using Frontend.Models
2023-10-08 23:43:49 +08:00
<div>
@if (Message.Left)
{
<Space Align="start">
<SpaceItem>
<Avatar Style="background-color: #5d92e4" Size="2.5rem">
@Message.Sender.First()
</Avatar>
2023-10-08 23:43:49 +08:00
</SpaceItem>
2023-10-09 13:31:03 +08:00
2023-10-08 23:43:49 +08:00
<SpaceItem>
2023-10-09 13:31:03 +08:00
<p style="font-size: 0.8rem; color: rgb(128,128,128)">
@Message.Sender
</p>
<div class="bubble-left">
<p class="message-text">
2023-10-08 23:43:49 +08:00
@Message.Text
</p>
</div>
</SpaceItem>
</Space>
}
else
{
<Space Align="start">
<SpaceItem>
2023-10-09 13:31:03 +08:00
<div>
<p style="font-size: 0.8rem; color: rgb(128, 128, 128); text-align: right;">
2023-10-08 23:43:49 +08:00
@Message.Sender
</p>
2023-10-09 13:31:03 +08:00
<div class="bubble-right">
<p class="message-text">
@Message.Text
</p>
</div>
2023-10-08 23:43:49 +08:00
</div>
</SpaceItem>
2023-10-09 13:31:03 +08:00
2023-10-08 23:43:49 +08:00
<SpaceItem>
<Avatar Style="background-color: #5d92e4" Size="2.5rem">
@Message.Sender.First()
</Avatar>
2023-10-08 23:43:49 +08:00
</SpaceItem>
</Space>
}
</div>
2023-10-07 18:55:22 +08:00
@code {
[Parameter]
public ChatMessage Message { get; set; } = new()
{
Left = true,
Sender = "default",
Text = "default"
};
2023-10-09 13:31:03 +08:00
2023-10-07 18:55:22 +08:00
}