@using Iceshrimp.Shared.Schemas.Web
<div class="attachment-container" data-count="@Attachments.Count">
    @foreach (var element in Attachments)
    {
        <AttachmentComponent Attachment="element" OnOpen="Open"/>
    }
    <AttachmentView @ref="View" Attachments="Attachments"></AttachmentView>
</div>

@code {
    [Parameter] [EditorRequired] public required IList<NoteAttachment> Attachments { get; set; }
    private                                      AttachmentView        View        { get; set; } = null!;

    private async Task Open(NoteAttachment attachment)
    {
        await View.OpenDialog(attachment);
    }
}