Skip to content

Commit f702274

Browse files
committed
(#424) wasm: update carousel component
1 parent 573188c commit f702274

File tree

1 file changed

+19
-3
lines changed
  • MiniSpace.Web/src/Astravent.Web.Wasm/Pages/Posts/Components

1 file changed

+19
-3
lines changed

MiniSpace.Web/src/Astravent.Web.Wasm/Pages/Posts/Components/PostItem.razor

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@using Astravent.Web.Wasm.Pages.Reports.Dialogs
22
@inject NavigationManager NavigationManager
33

4+
<!-- Post Card -->
45
<MudCard Class="post-card mb-4" Elevation="2">
56
<MudCardHeader>
67
<!-- Avatar with @onclick event to navigate to user profile -->
@@ -16,13 +17,27 @@
1617
</MudCardHeader>
1718

1819
<MudCardContent>
20+
<!-- Post Content -->
1921
<MudMarkdown Value="@Post.TextContent" />
2022

21-
@if (Post.MediaFiles != null && Post.MediaFiles.Any())
23+
@if (Post.MediaFiles != null && Post.MediaFiles.Count() == 1)
2224
{
2325
<MudImage Src="@Post.MediaFiles.First()" Alt="Post image" Class="mt-2" Style="width: 100%;" />
2426
}
25-
27+
else if (Post.MediaFiles != null && Post.MediaFiles.Any())
28+
{
29+
<MudCarousel Class="mt-2" Style="height:400px;" TData="string" AutoCycle="false">
30+
@foreach (var image in Post.MediaFiles)
31+
{
32+
<MudCarouselItem Transition="Transition.Custom" CustomTransitionEnter="bounceIn" CustomTransitionExit="bounceOut">
33+
<div class="d-flex" style="width:100%;">
34+
<MudImage Src="@image" Alt="Post image" Style="width: 100%; " />
35+
</div>
36+
</MudCarouselItem>
37+
}
38+
</MudCarousel>
39+
}
40+
<!-- Reactions Summary -->
2641
@if (ReactionsSummaries.TryGetValue(Post.Id, out var reactionsSummary))
2742
{
2843
<ReactionsSummary Summary="@reactionsSummary" />
@@ -31,6 +46,7 @@
3146

3247
<MudDivider />
3348

49+
<!-- Card Actions -->
3450
<MudCardActions Class="d-flex justify-space-between">
3551
<MudButton Variant="Variant.Text" Color="Color.Primary" OnClick="@(() => OnViewPost.InvokeAsync(Post.Id))">
3652
<MudIcon Icon="@Icons.Material.Filled.Visibility" Class="mr-1" /> View
@@ -72,9 +88,9 @@
7288
</MudMenuItem>
7389
</ChildContent>
7490
</MudMenu>
75-
7691
</MudCardActions>
7792

93+
<!-- Comment Section -->
7894
@if (isCommentSectionVisible)
7995
{
8096
<CommentSection Post="Post" OnSubmitComment="OnSubmitComment" />

0 commit comments

Comments
 (0)