Skip to content

Commit

Permalink
learnreact.com: extract YouTube.Embed component
Browse files Browse the repository at this point in the history
  • Loading branch information
chantastic committed Jan 27, 2020
1 parent 511d263 commit 9caf5a1
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 80 deletions.
13 changes: 13 additions & 0 deletions learnreact.com/components/youtube.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function Embed({ src = "", ...props }) {
return (
<iframe
width="560"
height="315"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
src={src}
{...props}
></iframe>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Use Props</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Use Props

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/JiFii5qySI0"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/JiFii5qySI0" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Declare Function Components</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Declare Function Components

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/3A_KwTXZFkI"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/3A_KwTXZFkI" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>
Expand All @@ -10,12 +11,5 @@ import { Index } from "../courses/function-components.mdx";

## Define Components with Arrow Functions

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/3A_KwTXZFkI"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/3A_KwTXZFkI" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Get Started</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Get Started

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/Y-_-KhMx0qU"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/Y-_-KhMx0qU" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Use defaultProps</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Use defaultProps

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/Uo5C-PX-h1k"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/Uo5C-PX-h1k" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>
Expand All @@ -10,12 +11,5 @@ import { Index } from "../courses/function-components.mdx";

## Use Destructuring Assignment

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/b_9FUiXM9_g"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/b_9FUiXM9_g" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Use Dynamic Tag Names</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Use Dynamic Tag Names

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/T7tb2nrQZ9Q"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/T7tb2nrQZ9Q" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>
Expand All @@ -11,12 +12,5 @@ import { Index } from "../courses/function-components.mdx";

## Use Object Rest Properties and JSX Spread Attributes

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/GcxXpP0lBXo"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/GcxXpP0lBXo" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Use propTypes</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Use propTypes

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/oty7VGcXK44"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/oty7VGcXK44" />
<Index />
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Index } from "../courses/function-components.mdx";
import * as YouTube from "../../components/youtube";

<Head>
<title>Learn React | Function Components > Use ref callbacks</title>
Expand All @@ -8,12 +9,5 @@ import { Index } from "../courses/function-components.mdx";

## Use ref callbacks

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/mfv6Bse2Egg"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
<YouTube.Embed src="https://www.youtube.com/embed/mfv6Bse2Egg" />
<Index />

0 comments on commit 9caf5a1

Please sign in to comment.