Skip to content

Commit

Permalink
feat(carousel): Orange branded 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
ffoodd committed May 14, 2020
1 parent 7117d47 commit e90edb8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 74 deletions.
28 changes: 12 additions & 16 deletions scss/_carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

.carousel {
position: relative;
margin-bottom: $carousel-margin-bottom; // Boosted mod
}

.carousel.pointer-event {
Expand Down Expand Up @@ -110,11 +111,11 @@
}
}
.carousel-control-prev {
left: 0;
left: $carousel-control-offset; // Boosted mod
background-image: if($enable-gradients, linear-gradient(90deg, rgba($black, .25), rgba($black, .001)), null);
}
.carousel-control-next {
right: 0;
right: $carousel-control-offset; // Boosted mod
background-image: if($enable-gradients, linear-gradient(270deg, rgba($black, .25), rgba($black, .001)), null);
}

Expand All @@ -124,15 +125,10 @@
display: inline-block;
width: $carousel-control-icon-width;
height: $carousel-control-icon-width;
background-repeat: no-repeat;
background-position: 50%;
background-size: 100% 100%;
}
.carousel-control-prev-icon {
background-image: escape-svg($carousel-control-prev-icon-bg);
background: escape-svg($carousel-control-prev-icon-bg) no-repeat 50% / #{$carousel-control-icon-size $carousel-control-icon-size}; // Boosted mod
}
.carousel-control-next-icon {
background-image: escape-svg($carousel-control-next-icon-bg);
transform: rotate(180deg); // Boosted mod
}


Expand All @@ -144,7 +140,7 @@
.carousel-indicators {
position: absolute;
right: 0;
bottom: 0;
bottom: -$carousel-margin-bottom;
left: 0;
z-index: 2;
display: flex;
Expand All @@ -164,16 +160,18 @@
margin-left: $carousel-indicator-spacer;
text-indent: -999px;
cursor: pointer;
background-color: $carousel-indicator-active-bg;
background-color: $carousel-control-color; // Boosted mod
background-clip: padding-box;
// Use transparent borders to increase the hit area by 10px on top and bottom.
border-top: $carousel-indicator-hit-area-height solid transparent;
border-bottom: $carousel-indicator-hit-area-height solid transparent;
opacity: $carousel-indicator-opacity;
@include transition($carousel-indicator-transition);
@include border-radius(50%, 50%); // Boosted mod
}

.active {
background-color: $carousel-indicator-active-bg; // Boosted mod
opacity: $carousel-indicator-active-opacity;
}
}
Expand All @@ -185,11 +183,9 @@

.carousel-caption {
position: absolute;
right: (100% - $carousel-caption-width) / 2;
bottom: $carousel-caption-spacer;
left: (100% - $carousel-caption-width) / 2;
padding-top: $carousel-caption-padding-y;
padding-bottom: $carousel-caption-padding-y;
left: map-get($spacers, 5);
padding: $carousel-caption-padding-y; // Boosted mod
color: $carousel-caption-color;
text-align: center;
background-color: color-contrast($carousel-caption-color); // Boosted mod
}
19 changes: 10 additions & 9 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1246,30 +1246,31 @@ $breadcrumb-border-radius: $border-radius !default;

// Carousel

$carousel-margin-bottom: map-get($spacers, 5) !default; // Boosted mod
$carousel-control-color: $black !default;
$carousel-control-width: map-get($spacers, 4) !default;
$carousel-control-opacity: .5 !default;
$carousel-control-hover-opacity: .9 !default;
$carousel-control-transition: opacity .15s ease, outline-offset .2s ease-in-out !default;
$carousel-control-opacity: null !default;
$carousel-control-hover-opacity: null !default;
$carousel-control-transition: outline-offset .2s ease-in-out !default;
$carousel-control-offset: map-get($spacers, 2) !default; // Boosted mod

$carousel-indicator-width: map-get($spacers, 2) !default;
$carousel-indicator-height: map-get($spacers, 2) !default;
$carousel-indicator-hit-area-height: null !default;
$carousel-indicator-spacer: 3px !default;
$carousel-indicator-opacity: .5 !default;
$carousel-indicator-opacity: null !default;
$carousel-indicator-active-bg: $primary !default;
$carousel-indicator-active-opacity: 1 !default;
$carousel-indicator-transition: opacity .6s ease !default;
$carousel-indicator-active-opacity: null !default;
$carousel-indicator-transition: null !default;

$carousel-caption-width: 70% !default;
$carousel-caption-color: $black !default;
$carousel-caption-padding-y: $spacer !default;
$carousel-caption-spacer: $spacer !default;
$carousel-caption-spacer: 0 !default;

$carousel-control-icon-width: 2.375rem !default;
$carousel-control-icon-size: map-get($spacers, 4) !default; // Boosted mod

$carousel-control-prev-icon-bg: $chevron-icon !default;
$carousel-control-next-icon-bg: $chevron-icon !default;

$carousel-transition-duration: .6s !default;
$carousel-transition: transform $carousel-transition-duration ease-in-out !default; // Define transform transition first if using multiple transitions (e.g., `transform 2s ease, opacity .5s ease-out`)
Expand Down
2 changes: 1 addition & 1 deletion site/assets/scss/_component-examples.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
display: block;
}

> :last-child {
> :last-child:not(.carousel) { // Boosted mod
margin-bottom: 0;
}

Expand Down
74 changes: 26 additions & 48 deletions site/content/docs/4.3/components/carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,23 @@ Please be aware that nested carousels are not supported, and carousels are gener

## Example

Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they're not explicitly required. Add and customize as you see fit.
Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content.

**The `.active` class needs to be added to one of the slides** otherwise the carousel will not be visible. Also be sure to set a unique id on the `.carousel` for optional controls, especially if you're using multiple carousels on a single page. Control and indicator elements must have a `data-target` attribute (or `href` for links) that matches the id of the `.carousel` element.
**The `.active` class needs to be added to one of the slides** otherwise the carousel will not be visible. Also be sure to set a unique id on the `.carousel` for controls, especially if you're using multiple carousels on a single page. Control and indicator elements must have a `data-target` attribute (or `href` for links) that matches the id of the `.carousel` element.

### Slides only

Here's a carousel with slides only. Note the presence of the `.d-block` and `.w-100` on carousel images to prevent browser default image alignment.

{{< example >}}
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
</div>
</div>
</div>
{{< /example >}}

### With controls

Adding in the previous and next controls:
<!-- Boosted mod: do not show nor mention carousel without controls -->

{{< example >}}
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#4bb4e6" text="First slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#50be87" text="Second slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#a885d8" text="Third slide" >}}
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
Expand All @@ -85,13 +63,13 @@ You can also add the indicators to the carousel, alongside the controls, too.
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#4bb4e6" text="First slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#50be87" text="Second slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#a885d8" text="Third slide" >}}
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
Expand All @@ -118,24 +96,24 @@ Add captions to your slides easily with the `.carousel-caption` element within a
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#4bb4e6" text="First slide" >}}
<div class="carousel-caption d-none d-md-block">
<h5>First slide label</h5>
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
<h5 class="mb-0">First slide label</h5>
<p class="mb-0">Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
</div>
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#50be87" text="Second slide" >}}
<div class="carousel-caption d-none d-md-block">
<h5>Second slide label</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h5 class="mb-0">Second slide label</h5>
<p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#a885d8" text="Third slide" >}}
<div class="carousel-caption d-none d-md-block">
<h5>Third slide label</h5>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
<h5 class="mb-0">Third slide label</h5>
<p class="mb-0">Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
</div>
</div>
</div>
Expand All @@ -158,13 +136,13 @@ Add `.carousel-fade` to your carousel to animate slides with a fade transition i
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#4bb4e6" text="First slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#50be87" text="Second slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#a885d8" text="Third slide" >}}
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleFade" role="button" data-slide="prev">
Expand All @@ -185,14 +163,14 @@ Add `data-interval=""` to a `.carousel-item` to change the amount of time to del
{{< example >}}
<div id="carouselExampleInterval" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" data-interval="10000">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
<div class="carousel-item active">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#4bb4e6" text="First slide" >}}
</div>
<div class="carousel-item" data-interval="2000">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#50be87" text="Second slide" >}}
</div>
<div class="carousel-item">
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#000" background="#a885d8" text="Third slide" >}}
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleInterval" role="button" data-slide="prev">
Expand Down

0 comments on commit e90edb8

Please sign in to comment.