inial impl
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
@namespace Faraon.Client.Components
|
||||
|
||||
<div class="game-card marias-card @(IsBack ? "card-back" : "") @(IsPlayable ? "playable" : (IsInteractive && !IsPlayable ? "unplayable" : "")) @CustomClass"
|
||||
style="@CustomStyle"
|
||||
@onclick="HandleClick">
|
||||
|
||||
@if (IsBack || Card == null)
|
||||
{
|
||||
<img src="assets/cards/@(Deck)/Card_Back.webp" class="marias-card-img" alt="Rub karty" draggable="false" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<img src="assets/cards/@(Deck)/@(Card.Suit)_@(Card.Rank).webp" class="marias-card-img" alt="@Card.Name" draggable="false" />
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public Card? Card { get; set; }
|
||||
[Parameter] public string Deck { get; set; } = "original";
|
||||
[Parameter] public bool IsBack { get; set; } = false;
|
||||
[Parameter] public bool IsPlayable { get; set; } = false;
|
||||
[Parameter] public bool IsInteractive { get; set; } = false;
|
||||
[Parameter] public string CustomClass { get; set; } = "";
|
||||
[Parameter] public string CustomStyle { get; set; } = "";
|
||||
[Parameter] public EventCallback<Card> OnCardClicked { get; set; }
|
||||
|
||||
private async Task HandleClick()
|
||||
{
|
||||
if (IsInteractive && Card != null)
|
||||
{
|
||||
await OnCardClicked.InvokeAsync(Card);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user