Skip to content

Commit

Permalink
Merge branch 'v6.3-responsive-embed' of git://github.com/andycochran/…
Browse files Browse the repository at this point in the history
…foundation-sites into andycochran-v6.3-responsive-embed
  • Loading branch information
kball committed Oct 5, 2016
2 parents df8dc1a + 66bf055 commit ab389a7
Show file tree
Hide file tree
Showing 16 changed files with 173 additions and 140 deletions.
2 changes: 1 addition & 1 deletion customizer/complete.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dropdown",
"dropdown_menu",
"equalizer",
"flex_video",
"responsive_embed",
"interchange",
"label",
"magellan",
Expand Down
6 changes: 3 additions & 3 deletions customizer/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ equalizer:
- mediaQuery
- timerAndImageLoader

flex_video:
sass: flex-video

interchange:
js: interchange
js_utils:
Expand Down Expand Up @@ -137,6 +134,9 @@ progress_bar:
progress_element:
sass: progress-element

responsive_embed:
sass: responsive-embed

responsive_menu:
js: responsiveMenu
js_utils:
Expand Down
1 change: 1 addition & 0 deletions docs/assets/scss/docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@import 'examples/motion-ui';
@import 'examples/off-canvas';
@import 'examples/orbit';
@import 'examples/responsive-embed';
@import 'examples/reveal';
@import 'examples/top-bar';

Expand Down
5 changes: 5 additions & 0 deletions docs/assets/scss/examples/_responsive-embed.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Responsive Embed

.panorama {
@include responsive-embed(256 by 81);
}
33 changes: 0 additions & 33 deletions docs/pages/flex-video.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Get to know the pieces of Foundation.
<h4>Media</h4>
<ul>
<li><a href="badge.html">Badge</a></li>
<li><a href="flex-video.html">Flex Video</a></li>
<li><a href="responsive-embed.html">Responsive Embed</a></li>
<li><a href="label.html">Label</a></li>
<li><a href="orbit.html">Orbit</a></li>
<li><a href="progress-bar.html">Progress Bar</a></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/kitchen-sink.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,10 @@ description: Everything but.

---

## Flex Video
## Responsive Embed

```html_example
<div class="flex-video">
<div class="responsive-embed">
<iframe width="420" height="315" src="https://www.youtube.com/embed/V9gkYw35Vws" frameborder="0" allowfullscreen></iframe>
</div>
```
Expand Down
39 changes: 39 additions & 0 deletions docs/pages/responsive-embed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Responsive Embed
description: Wrap embedded content like videos, maps, and calendars in a responsive embed container to maintain the correct aspect ratio regardless of screen size.
sass: scss/components/_responsive-embed.scss
---

To make sure embedded content maintains its aspect ratio as the width of the screen changes, wrap the `iframe`, `object`, `embed`, or `video` in a container with the `.responsive-embed` class.

```html_example
<div class="responsive-embed">
<iframe width="420" height="315" src="https://www.youtube.com/embed/mM5_T-F1Yn4" frameborder="0" allowfullscreen></iframe>
</div>
```

---

The default ratio is 4:3. Add the `.widescreen` class to change it to 16:9.

```html_example
<div class="responsive-embed widescreen">
<iframe width="560" height="315" src="https://www.youtube.com/embed/WUgvvPRH7Oc" frameborder="0" allowfullscreen></iframe>
</div>
```

---

If you need to embed content with other aspect ratios, such as 256:81, the `responsive-embed()` mixin makes it easy to add your own custom classes.

```scss
.panorama {
@include responsive-embed(256 by 81);
}
```

```html_example
<div class="panorama">
<iframe width="1024" height="315" src="https://www.youtube.com/embed/bnD9I24EL_4" frameborder="0" allowfullscreen></iframe>
</div>
```
2 changes: 1 addition & 1 deletion docs/partials/component-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

<li class="docs-nav-title">Media</li>
<li{{#ifpage 'badge'}} class="current"{{/ifpage}}><a href="badge.html">Badge</a></li>
<li{{#ifpage 'flex-video'}} class="current"{{/ifpage}}><a href="flex-video.html">Flex Video</a></li>
<li{{#ifpage 'responsive-embed'}} class="current"{{/ifpage}}><a href="responsive-embed.html">Responsive Embed</a></li>
<li{{#ifpage 'label'}} class="current"{{/ifpage}}><a href="label.html">Label</a></li>
<li{{#ifpage 'orbit'}} class="current"{{/ifpage}}><a href="orbit.html">Orbit <span class="label">JS</span> <small>Carousel</small></a></li>
<li{{#ifpage 'progress-bar'}} class="current"{{/ifpage}}><a href="progress-bar.html">Progress Bar</a></li>
Expand Down
7 changes: 3 additions & 4 deletions meteor-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Or you can comment out the components you don't need:
@include foundation-drilldown-menu;
@include foundation-dropdown;
@include foundation-dropdown-menu;
@include foundation-flex-video;
@include foundation-responsive-embed;
@include foundation-label;
@include foundation-media-object;
@include foundation-menu;
Expand All @@ -70,7 +70,7 @@ Or you can comment out the components you don't need:
@include foundation-top-bar;
```

Note: For now there is a Motion-UI library added in the package (css, js files). It is needed for some Foundation plugins. Maybe in the future it will be separated package.
Note: For now there is a Motion-UI library added in the package (css, js files). It is needed for some Foundation plugins. Maybe in the future it will be separated package.

### 3. Overwrite Foundation settings

Expand Down Expand Up @@ -145,6 +145,5 @@ You will find more info about particular plugins on its docs page here: [http://

#### Known problems

1. **Conflicts with Meteor events**.
1. **Conflicts with Meteor events**.
Solution: Try to always wrap Foundation's DOM nodes into another ones in your Meteor templates. This applies only to nodes on which are initialized Foundation's JS plugins and which are the first nodes in the Meteor templates with attached custom Meteor events. For more details read the last comments here: [#7248](https://github.com/zurb/foundation-sites/issues/7248)

2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Package.onUse(function(api) {
'scss/components/_drilldown.scss',
'scss/components/_dropdown-menu.scss',
'scss/components/_dropdown.scss',
'scss/components/_flex-video.scss',
'scss/components/_flex.scss',
'scss/components/_float.scss',
'scss/components/_label.scss',
Expand All @@ -39,6 +38,7 @@ Package.onUse(function(api) {
'scss/components/_orbit.scss',
'scss/components/_pagination.scss',
'scss/components/_progress-bar.scss',
'scss/components/_responsive-embed.scss',
'scss/components/_reveal.scss',
'scss/components/_slider.scss',
'scss/components/_sticky.scss',
Expand Down
64 changes: 1 addition & 63 deletions scss/components/_flex-video.scss
Original file line number Diff line number Diff line change
@@ -1,63 +1 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source

////
/// @group flex-video
////

/// Margin below a flex video container.
/// @type Number
$flexvideo-margin-bottom: rem-calc(16) !default;

/// Padding used to create a 4:3 aspect ratio.
/// @type Number
$flexvideo-ratio: 4 by 3 !default;

/// Padding used to create a 16:9 aspect ratio.
/// @type Number
$flexvideo-ratio-widescreen: 16 by 9 !default;

/// Creates a percentage height that can be used as padding in a flex video container.
/// @param {List} $ratio - Ratio to use to calculate the height, formatted as `x by y`.
/// @return {Number} A percentage value that can be used as the `padding-bottom` parameter of a flex video container.
@function flex-video($ratio) {
$w: nth($ratio, 1);
$h: nth($ratio, 3);
@return $h / $w * 100%;
}

/// Creates a flex video container.
/// @param {List} $ratio [$flexvideo-ratio] - Ratio to use for the container, formatted as `x by y`.
@mixin flex-video($ratio: $flexvideo-ratio) {
position: relative;
height: 0;
padding-bottom: flex-video($ratio);
margin-bottom: $flexvideo-margin-bottom;
overflow: hidden;

iframe,
object,
embed,
video {
position: absolute;
top: 0;
#{$global-left}: 0;
width: 100%;
height: 100%;
}
}

@mixin foundation-flex-video {
.flex-video {
@include flex-video;

&.widescreen {
padding-bottom: flex-video($flexvideo-ratio-widescreen);
}

&.vimeo {
padding-top: 0;
}
}
}
@import 'responsive-embed';
84 changes: 84 additions & 0 deletions scss/components/_responsive-embed.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source

////
/// @group responsive-embed
////

/// Margin below a responsive embed container.
/// @type Number
$responsive-embed-margin-bottom: rem-calc(16) !default;

/// Padding used to create a 4:3 aspect ratio.
/// @type Number
$responsive-embed-ratio: 4 by 3 !default;

/// Padding used to create a 16:9 aspect ratio.
/// @type Number
$responsive-embed-ratio-widescreen: 16 by 9 !default;

/// Creates a percentage height that can be used as padding in a responsive embed container.
/// @param {List} $ratio - Ratio to use to calculate the height, formatted as `x by y`.
/// @return {Number} A percentage value that can be used as the `padding-bottom` parameter of a responsive embed container.
@function responsive-embed($ratio) {
$w: nth($ratio, 1);
$h: nth($ratio, 3);
@return $h / $w * 100%;
}

/// Creates a responsive embed container.
/// @param {List} $ratio [$responsive-embed-ratio] - Ratio to use for the container, formatted as `x by y`.
@mixin responsive-embed($ratio: $responsive-embed-ratio) {
position: relative;
height: 0;
padding-bottom: responsive-embed($ratio);
margin-bottom: $responsive-embed-margin-bottom;
overflow: hidden;

iframe,
object,
embed,
video {
position: absolute;
top: 0;
#{$global-left}: 0;
width: 100%;
height: 100%;
}
}

@mixin foundation-responsive-embed {
.responsive-embed, .flex-video {
@include responsive-embed;

&.widescreen {
padding-bottom: responsive-embed($responsive-embed-ratio-widescreen);
}
}
}

@mixin foundation-flex-video {
@warn 'This mixin is being replaced by foundation-responsive-embed(). foundation-flex-video() will be removed in Foundation 6.4.';
@include foundation-responsive-embed;
}

@mixin flex-video($ratio: $responsive-embed-ratio) {
@warn 'This mixin is being replaced by responsive-embed(). flex-video() will be removed in Foundation 6.4.';
position: relative;
height: 0;
padding-bottom: responsive-embed($ratio);
margin-bottom: $responsive-embed-margin-bottom;
overflow: hidden;

iframe,
object,
embed,
video {
position: absolute;
top: 0;
#{$global-left}: 0;
width: 100%;
height: 100%;
}
}
4 changes: 2 additions & 2 deletions scss/foundation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@import 'components/dropdown-menu';
@import 'components/dropdown';
@import 'components/flex';
@import 'components/flex-video';
@import 'components/responsive-embed';
@import 'components/label';
@import 'components/media-object';
@import 'components/menu';
Expand Down Expand Up @@ -76,7 +76,7 @@
@include foundation-drilldown-menu;
@include foundation-dropdown;
@include foundation-dropdown-menu;
@include foundation-flex-video;
@include foundation-responsive-embed;
@include foundation-label;
@include foundation-media-object;
@include foundation-off-canvas;
Expand Down
Loading

0 comments on commit ab389a7

Please sign in to comment.