Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to embed youtube videos to tools
- Loading branch information
1 parent
c5233fd
commit da1fa9b
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exports.up = function(knex) { | ||
return knex.schema.table("tools", function(table) { | ||
table.string("youtube_id"); | ||
}); | ||
}; | ||
|
||
exports.down = function(knex) { | ||
return knex.schema.table("tools", function(table) { | ||
table.dropColumn("youtube_id"); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import { css } from "@emotion/core"; | ||
|
||
interface Props { | ||
id: string; | ||
} | ||
|
||
const YouTube = ({ id }: Props) => ( | ||
<div | ||
css={css` | ||
position: relative; | ||
padding-bottom: 56.25%; | ||
height: 0; | ||
overflow: hidden; | ||
max-width: 100%; | ||
`} | ||
> | ||
<iframe | ||
css={css` | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
`} | ||
src={`https://www.youtube.com/embed/${id}`} | ||
allow="autoplay; encrypted-media" | ||
title="Embedded YouTube video" | ||
/> | ||
</div> | ||
); | ||
|
||
export default YouTube; |
da1fa9b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://usestools-ly9iybo0i.now.sh to the following aliases: