<button
    nxButton="tertiary small"
    class="nx-margin-bottom-0"
    [nxContextMenuTriggerFor]="nxvVersionSelect"
    (contextMenuOpened)="_versionSelectIsOpened = true"
    (contextMenuClosed)="_versionSelectIsOpened = false"
>
    <span class="desktop-label">{{ formatVersion(_selected) }}</span>
    <span class="mobile-label">{{ mobileFormatVersion(_selected) }}</span>
    <nx-icon name="chevron-down" nxIconPositionEnd [class.icon-rotated]="_versionSelectIsOpened"></nx-icon>
</button>

<nx-context-menu #nxvVersionSelect="nxContextMenu">
    @for (channel of versions?.channels; track channel) {
        <button nxContextMenuItem type="button" (click)="changeVersion(channel)" [value]="channel.name">
            {{ channel.name }}
        </button>
    }
</nx-context-menu>
