Skip to content

Commit 0c0a242

Browse files
added embedding youtube videos
1 parent b5ba96d commit 0c0a242

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
112112

113113
### Added
114114

115-
- Added Google Analytics 4 Integration
115+
- Added Google Analytics 4 Integration
116+
117+
### Added
118+
119+
- Added Embeded Youtube videos

_includes/Youtube/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import S from './styles';
2+
3+
const YoutubeEmbed = ({ id }) => {
4+
const url = `https://www.youtube.com/embed/${id}`;
5+
6+
return (
7+
<S.YoutubeContainer>
8+
<S.YoutubeIframe src={url} allowfullscreen />
9+
</S.YoutubeContainer>
10+
);
11+
};
12+
13+
export default YoutubeEmbed;

_includes/Youtube/styles.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import styled from 'styled-components'
2+
3+
const YoutubeContainer = styled.div`
4+
position: relative;
5+
padding-bottom: 56.25%;
6+
height: 0;
7+
overflow: hidden;
8+
max-width: 100%;
9+
`;
10+
11+
const YoutubeIframe = styled.iframe`
12+
position: absolute;
13+
top: 0;
14+
left: 0;
15+
width: 100%;
16+
height: 100%;
17+
18+
19+
`;
20+
21+
export default { YoutubeContainer, YoutubeIframe };

0 commit comments

Comments
 (0)