Skip to content
This repository was archived by the owner on Jan 4, 2024. It is now read-only.

Commit a88f93c

Browse files
authored
Responsive embed (#128)
* Add responsive embed/iframe utility * Add release notes * Improve use of modifier * CSS build * Include the file and build * Correct changelog example * Add docs for responsive embeds * Build css
1 parent 2a28012 commit a88f93c

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _The format of this document is based on [Keep a Changelog](http://keepachangelo
44

55
### Changed
66

7-
- Added support for responsive iframe / video embeds via `.responsive-embed__container--video` and `.responsive-embed__iframe`
7+
- Added support for responsive iframe / video embeds via `.responsive-embed`, `.responsive-embed--video` and `.responsive-embed__iframe`
88

99
## [v1.3.2](https://github.com/RaspberryPiFoundation/Bits/compare/v1.3.1...v1.3.2) - 2020-02-17
1010

doc/styles/embeds.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Embedded iframes can be made responsive using the following classes:
2+
3+
- `.responsive-embed` (for the container)
4+
- `.responsive-embed--video` (for the container)
5+
- `.responsive-embed__iframe` (for the iframe)
6+
7+
The `--video` modifier assumes an aspect ratio of 16:9 (further modifiers should be added as needed).
8+
9+
```
10+
<div class="responsive-embed responsive-embed--video">
11+
<iframe class="responsive-embed__iframe" src="https://www.youtube.com/embed/56B0P5WdAGQ"></iframe>
12+
</div>
13+
```

lib/Bits.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -11768,12 +11768,12 @@ strong {
1176811768
margin-left: 0 !important;
1176911769
}
1177011770
}
11771-
.responsive_embed {
11771+
.responsive-embed {
1177211772
position: relative;
1177311773
overflow: hidden;
1177411774
padding-top: 100%;
1177511775
}
11776-
.responsive_embed--video {
11776+
.responsive-embed--video {
1177711777
padding-top: 56.25%;
1177811778
}
1177911779

lib/Bits.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/styles/utilities/_responsive-embed.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.responsive_embed {
1+
.responsive-embed {
22
position: relative;
33
overflow: hidden;
44
padding-top: 100%;

styleguide.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ module.exports = {
1717
name: 'Responsive Breakpoints',
1818
content: 'doc/styles/breakpoints.md',
1919
},
20+
{
21+
name: 'Responsive Embeds',
22+
content: 'doc/styles/embeds.md',
23+
},
2024
{
2125
name: 'Fonts',
2226
content: 'doc/styles/fonts.md',

0 commit comments

Comments
 (0)