Files
decePubClient/Components/Daisy/DataDisplay/DCarouselItem.razor
T
thepraandClaude Opus 5.5 d71040f262 Add carousel navigation and the mixed checkbox state, without script
These were left out because daisyUI does them with scripts or with links that
<base href="/"> breaks.

DCarousel:
- ShowNavigation adds previous/next links on each slide, and ShowIndicators adds
  a row of numbered links under the strip.
- The links point at the slides' ids under the current path, so Blazor treats
  them as same-page fragments and scrolls the strip.

DCheckbox:
- Indeterminate renders aria-checked="mixed", which daisyUI draws like
  :indeterminate.
- A click clears it through IndeterminateChanged.
- The neo inset well leaves the mixed state alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
2026-10-03 12:43:07 +02:00

29 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@inherits DComponentBase
@implements IDisposable
@* One slide of a DCarousel. It registers with the carousel for its id and, with ShowNavigation, draws the
previous/next links over itself. *@
<div @attributes="AdditionalAttributes" id="@Id" class="@Cx("carousel-item", HasNavigation ? "relative" : null, Class)">
@ChildContent
@if (HasNavigation)
{
<div class="absolute inset-x-2 top-1/2 flex -translate-y-1/2 justify-between">
<a href="@Parent.Link(Index - 1)" class="btn btn-circle btn-sm" aria-label="@Parent.PreviousText">❮</a>
<a href="@Parent.Link(Index + 1)" class="btn btn-circle btn-sm" aria-label="@Parent.NextText">❯</a>
</div>
}
</div>
@code {
[CascadingParameter] DCarousel Parent { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
int Index => Parent?.IndexOf(this) ?? -1;
string Id => Parent is null ? null : Parent.SlideId(Index);
bool HasNavigation => Parent is { ShowNavigation: true, Count: > 1 };
protected override void OnInitialized() => Parent?.Add(this);
public void Dispose() => Parent?.Remove(this);
}