-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8ddf2c
commit ad6c6a4
Showing
7 changed files
with
82 additions
and
5 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,74 @@ | ||
import React from "react" | ||
import PropTypes from "prop-types" | ||
|
||
import Dailymotion from "./providers/dailymotion" | ||
import PornHub from "./providers/pornhub" | ||
import YouTube from "./providers/youtube" | ||
import Vimeo from "./providers/vimeo" | ||
|
||
import getProvider from "../utils/get-provider" | ||
|
||
export default function Switcher({ url, width, height, title, className }) { | ||
const { id, provider } = getProvider(url) | ||
|
||
switch (provider) { | ||
case "Dailymotion": | ||
return ( | ||
<Dailymotion | ||
id={id} | ||
width={width} | ||
height={height} | ||
className={className} | ||
title={title} | ||
/> | ||
) | ||
case "PornHub": | ||
return ( | ||
<PornHub | ||
id={id} | ||
width={width} | ||
height={height} | ||
className={className} | ||
title={title} | ||
/> | ||
) | ||
case "YouTube": | ||
return ( | ||
<YouTube | ||
id={id} | ||
width={width} | ||
height={height} | ||
className={className} | ||
title={title} | ||
/> | ||
) | ||
case "Vimeo": | ||
return ( | ||
<Vimeo | ||
id={id} | ||
width={width} | ||
height={height} | ||
className={className} | ||
title={title} | ||
/> | ||
) | ||
default: | ||
return ( | ||
<a href={url} title={title} className={className}> | ||
{url} | ||
</a> | ||
) | ||
} | ||
} | ||
|
||
Switcher.propTypes = { | ||
url: PropTypes.string.isRequired, | ||
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
title: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
} | ||
|
||
Switcher.defaultProps = { | ||
className: "video", | ||
} |
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import Dailymotion from "./components/dailymotion" | ||
import PornHub from "./components/pornhub" | ||
import YouTube from "./components/youtube" | ||
import Vimeo from "./components/vimeo" | ||
import Dailymotion from "./components/providers/dailymotion" | ||
import PornHub from "./components/providers/pornhub" | ||
import YouTube from "./components/providers/youtube" | ||
import Vimeo from "./components/providers/vimeo" | ||
|
||
import Switcher from "./components/switcher" | ||
|
||
import getProvider from "./utils/get-provider" | ||
import providers from "./utils/providers" | ||
|
||
export { Dailymotion, PornHub, YouTube, Vimeo, getProvider, providers } | ||
export default Switcher |