Skip to content

Commit e33c2f6

Browse files
author
Lucas Dias
committed
sctructuring and adding externals
1 parent 70b8d88 commit e33c2f6

File tree

13 files changed

+12194
-90
lines changed

13 files changed

+12194
-90
lines changed

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
src
2-
demo
2+
example
33
.babelrc
4+
webpack.config.dev.js
45
webpack.config.js
56
node_modules

example/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import ReactNetflixPlayer from '../src';
3+
import ReactNetflixPlayer from '../dist/ReactNetflixPlayer.js';
44

55
ReactDOM.render(
66
<div>
77
<ReactNetflixPlayer
88
// Vídeo Link - Just data is required
9-
src="http://lucasjunior.com.br/teste.mp4"
9+
src="https://storage.googleapis.com/webfundamentals-assets/videos/chrome.mp4"
1010
// src={"http://videoinvalid"}
1111
title="Dragon Ball Z"
1212
subTitle="Opening"
@@ -15,15 +15,15 @@ ReactDOM.render(
1515
// Text language of player
1616
playerLanguage="pt"
1717
// Action when the button X (close) is clicked
18-
backButton={() => {}}
18+
backButton={() => { }}
1919
// The player use the all viewport
2020
fullPlayer
2121
autoPlay
2222
startPosition={0}
2323
// The info of the next video action
2424
dataNext={{ title: 'Não existe um próximo vídeo.' }}
2525
// The action call when the next video is clicked
26-
onNextClick={() => {}}
26+
onNextClick={() => { }}
2727
// The list reproduction data, will be render in this order
2828
reprodutionList={[
2929
{
@@ -45,9 +45,9 @@ ReactDOM.render(
4545
};
4646
}}
4747
// The function is call when the video finish
48-
onEnded={() => {}}
48+
onEnded={() => { }}
4949
// The function is call when the video is playing (One time for frame)
50-
onTimeUpdate={() => {}}
50+
onTimeUpdate={() => { }}
5151
// Enable the orverlay when player is paused
5252
overlayEnabled
5353
// Enabled the auto clode controlls of player
@@ -57,7 +57,7 @@ ReactDOM.render(
5757
secundaryColor="#ffffff"
5858
fontFamily="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"
5959

60-
// subtitleMedia="/teste.vtt"
60+
// subtitleMedia="/teste.vtt"
6161
/>
6262
</div>,
6363
document.getElementById('root'),

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-netflix-player",
3-
"version": "1.1.3",
3+
"version": "1.1.5",
44
"description": "React Video Player Based in Netflix Design",
55
"main": "./dist/ReactNetflixPlayer.js",
66
"license": "MIT",
@@ -25,10 +25,6 @@
2525
"printWidth": 120
2626
},
2727
"author": "Lucas Junior Dias",
28-
"peerDependencies": {
29-
"react": "^16.0.0",
30-
"react-dom": "^16.13.1"
31-
},
3228
"devDependencies": {
3329
"babel-cli": "^6.26.0",
3430
"babel-core": "^6.21.0",
@@ -47,16 +43,19 @@
4743
"eslint-plugin-react": "^7.20.6",
4844
"eslint-plugin-react-hooks": "^4.1.0",
4945
"extract-text-webpack-plugin": "^3.0.2",
50-
"path": "^0.12.7",
5146
"prettier": "^2.0.5",
5247
"webpack": "^4.43.0",
5348
"webpack-cli": "^3.2.1",
5449
"webpack-dev-server": "^3.11.0"
5550
},
51+
"peerDependencies": {
52+
"react": "^16 || ^17",
53+
"react-dom": "^16 || ^17"
54+
},
5655
"dependencies": {
5756
"i18next": "^19.7.0",
5857
"react-i18next": "^11.7.1",
5958
"react-icons": "^3.9.0",
6059
"styled-components": "^5.1.1"
6160
}
62-
}
61+
}

src/index.js renamed to src/components/ReactNetflixPlayer/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ import {
3131
ItemListReproduction,
3232
ItemListQuality,
3333
} from './styles';
34-
35-
import translations from './translations';
34+
import translations from '../../i18n';
3635

3736
i18n.use(initReactI18next).init({
3837
resources: translations,
@@ -63,7 +62,7 @@ export default function ReactNetflixPlayer({
6362
onErrorVideo = false,
6463
onNextClick = false,
6564
onClickItemListReproduction = false,
66-
onCrossClick = () => {},
65+
onCrossClick = () => { },
6766
startPosition = 0,
6867

6968
dataNext = {},

src/styles.js renamed to src/components/ReactNetflixPlayer/styles.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ const toUpOpacity = keyframes`
1919

2020
export const Container = styled.div`
2121
text-align: left;
22-
22+
2323
& > * {
2424
outline: 0;
2525
box-sizing: border-box;
2626
margin: 0;
2727
padding: 0;
2828
font-family: ${props =>
29-
props.fontFamily
30-
? props.fontFamily
31-
: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"};
29+
props.fontFamily
30+
? props.fontFamily
31+
: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"};
3232
}
3333
3434
width: 100%;
@@ -51,9 +51,9 @@ export const Container = styled.div`
5151
text-shadow: #222 0 0 5px;
5252
background: none;
5353
font-family: ${props =>
54-
props.fontFamily
55-
? props.fontFamily
56-
: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"};
54+
props.fontFamily
55+
? props.fontFamily
56+
: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"};
5757
}
5858
}
5959

src/components/index..js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import ReactNetflixPlayer from './ReactNetflixPlayer';
2+
3+
export { ReactNetflixPlayer };

src/i18n/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import enUs from './locales/en-us';
2+
import ptBr from './locales/pt-br';
3+
4+
const translations = {
5+
pt: ptBr,
6+
en: enUs,
7+
};
8+
9+
export default translations;

src/i18n/locales/en-us.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const enUs = {
2+
translation: {
3+
youAreWatching: 'Você está assistindo',
4+
paused: 'Pausado',
5+
tryAccessingOtherQuality: 'Tente acessar por outra qualidade',
6+
goBack: 'Voltar à navegação',
7+
speeds: 'Velocidades',
8+
nextEpisode: 'Próximo Episódio',
9+
playlist: 'Lista de Reprodução',
10+
playError: 'Ocorreu um erro ao tentar reproduzir este vídeo -_-',
11+
},
12+
};
13+
14+
export default enUs;

src/i18n/locales/pt-br.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const ptBr = {
2+
translation: {
3+
youAreWatching: "You're watching",
4+
paused: 'Paused',
5+
tryAccessingOtherQuality: 'Try changing the image quality',
6+
goBack: 'Go Back',
7+
speeds: 'Speed',
8+
nextEpisode: 'Next Episode',
9+
playlist: 'Playlist',
10+
playError: 'Something went wrong playing this video',
11+
},
12+
};
13+
14+
export default ptBr;

src/translations.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)