Skip to content

Commit

Permalink
feat(blazorui): improve BitSwiper component #8559 (#8570)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrastegari authored Sep 10, 2024
1 parent 3015d09 commit 16ffcaa
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 580 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</CascadingValue>
</div>

@if (ShowNextPrev)
@if (HideNextPrev is false)
{
<div class="bit-swp-rbt" @onclick="async() => await Go(true)" style="@_rightButtonStyle" @onpointerdown:stopPropagation>
<i class="bit-icon bit-icon--ChevronRight" />
Expand All @@ -26,14 +26,14 @@
</div>
}

@*@if (ShowDots)
@*@if (HideDots is false)
{
<div class="bit-swp-dot" style="@_directionStyle">
@for (int i = 0; i < _pagesCount; i++)
{
int index = i;
<div class="@(_currentPage == index ? " current" : null)" @onclick="(() => GotoPage(index))"></div>
}
</div>
<div class="bit-swp-dot" style="@_directionStyle">
@for (int i = 0; i < _pagesCount; i++)
{
int index = i;
<div class="@(_currentPage == index ? " current" : null)" @onclick="(() => GotoPage(index))"></div>
}
</div>
}*@
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,61 @@ public partial class BitSwiper : BitComponentBase, IAsyncDisposable



/// <summary>
/// Sets the duration of the scrolling animation in seconds (the default value is 0.5).
/// </summary>
[Parameter] public double AnimationDuration { get; set; } = 0.5;

///// <summary>
///// If enabled the swiper items will navigate in an infinite loop.
///// Enables/disables the auto scrolling of the slides.
///// </summary>
//[Parameter] public bool InfiniteScrolling { get; set; }
//[Parameter] public bool AutoPlay { get; set; }

///// <summary>
///// Sets the interval of the auto scrolling in milliseconds (the default value is 2000).
///// </summary>
//[Parameter] public double AutoPlayInterval { get; set; } = 2000;

/// <summary>
/// Items of the swiper.
/// </summary>
[Parameter] public RenderFragment? ChildContent { get; set; }

///// <summary>
///// Shows or hides the Dots indicator at the bottom of the BitSwiper.
///// Hides the Dots indicator at the bottom of the BitSwiper.
///// </summary>
//[Parameter] public bool ShowDots { get; set; } = true;
//[Parameter] public bool HideDots { get; set; }

/// <summary>
/// Shows or hides the Next/Prev buttons of the BitSwiper.
/// Hides the Next/Prev buttons of the BitSwiper.
/// </summary>
[Parameter] public bool ShowNextPrev { get; set; } = true;
[Parameter] public bool HideNextPrev { get; set; }

///// <summary>
///// If enabled the swiper items will navigate in an infinite loop.
///// </summary>
//[Parameter] public bool InfiniteScrolling { get; set; }

/// <summary>
/// Number of items that is going to be changed on navigation
/// Number of items that is going to be changed on navigation.
/// </summary>
[Parameter] public int ScrollItemsCount { get; set; } = 1;

///// <summary>
///// Enables/disables the auto scrolling of the slides.
///// </summary>
//[Parameter] public bool AutoPlay { get; set; }

///// <summary>
///// Sets the interval of the auto scrolling in milliseconds (the default value is 2000).
///// </summary>
//[Parameter] public double AutoPlayInterval { get; set; } = 2000;

/// <summary>
/// Sets the duration of the scrolling animation in seconds (the default value is 0.5).
/// Navigates to the next swiper item.
/// </summary>
[Parameter] public double AnimationDuration { get; set; } = 0.5;


public async Task GoNext() => await Go(true);

/// <summary>
/// Navigates to the previous swiper item.
/// </summary>
public async Task GoPrev() => await Go(false);

public async Task GoNext() => await Go(true);

/// <summary>
/// Navigates to the given swiper item index.
/// </summary>
public async Task GoTo(int index) => await GotoPage(index - 1);


Expand Down Expand Up @@ -120,7 +129,7 @@ internal void RegisterItem(BitSwiperItem item)
_allItems.Add(item);
}

internal void UnregisterItem(BitSwiperItem carouselItem) => _allItems.Remove(carouselItem);
internal void UnregisterItem(BitSwiperItem item) => _allItems.Remove(item);



Expand Down
Loading

0 comments on commit 16ffcaa

Please sign in to comment.