Skip to content

Commit

Permalink
feat(blocks>slider): only show prev/next arrows when more than one sl…
Browse files Browse the repository at this point in the history
…ide (#2949)
  • Loading branch information
cbrueffer authored Jun 18, 2023
1 parent 8b1b5ee commit 92cc5a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/wowchemy/layouts/partials/blocks/slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
{{ $page := .wcPage }}
{{ $block := .wcBlock }}
{{ $hash_id := .wcIdentifier }}
{{ $slide_count := len $block.content.slides }}

<!-- Indicators -->
{{ if gt $slide_count 1 }}
<ol class="carousel-indicators">
{{ range $index, $item := $block.content.slides }}
<li data-target="#{{$hash_id}}" data-slide-to="{{$index}}" {{if eq $index 0}}class="active"{{end}}></li>
{{ end }}
</ol>
{{ end }}

<!-- Carousel slides wrapper -->
<div class="carousel-inner">
Expand Down Expand Up @@ -81,6 +84,7 @@ <h1 class="hero-title ">
</div>

<!-- Left and right controls -->
{{ if gt $slide_count 1 }}
<a class="carousel-control-prev" href="#{{$hash_id}}" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Previous</span>
Expand All @@ -89,3 +93,4 @@ <h1 class="hero-title ">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
{{ end }}
5 changes: 5 additions & 0 deletions modules/wowchemy/layouts/partials/blocks/v1/slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
{{ $page := .wcPage }}
{{ $block := .wcBlock }}
{{ $hash_id := .wcIdentifier }}
{{ $slide_count := len $block.Params.content.slides }}

<!-- Indicators -->
{{ if gt $slide_count 1 }}
<ol class="carousel-indicators">
{{ range $index, $item := $block.Params.content.slides }}
<li data-target="#{{$hash_id}}" data-slide-to="{{$index}}" {{if eq $index 0}}class="active"{{end}}></li>
{{ end }}
</ol>
{{ end }}

<!-- Carousel slides wrapper -->
<div class="carousel-inner">
Expand Down Expand Up @@ -75,6 +78,7 @@ <h1 class="hero-title">
</div>

<!-- Left and right controls -->
{{ if gt $slide_count 1 }}
<a class="carousel-control-prev" href="#{{$hash_id}}" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Previous</span>
Expand All @@ -83,3 +87,4 @@ <h1 class="hero-title">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
{{ end }}

0 comments on commit 92cc5a2

Please sign in to comment.