This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add example clock with react-tv as renderer
- Loading branch information
1 parent
80fe052
commit caf34ee
Showing
11 changed files
with
2,738 additions
and
128 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,14 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Clock App With React-TV</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<h1>Clock App with React-TV</h1> | ||
|
||
<div id="root"></div> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</html> |
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,22 @@ | ||
{ | ||
"name": "clock-app-with-react-tv", | ||
"version": "1.0.0", | ||
"author": "Raphael Amorim", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "webpack", | ||
"start": "webpack-dev-server --progress --colors" | ||
}, | ||
"dependencies": { | ||
"react": "16.0.0-alpha.3", | ||
"react-tv": "file:../../" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.4.5", | ||
"babel-loader": "^6.2.1", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-react": "^6.3.13", | ||
"webpack": "^1.12.12", | ||
"webpack-dev-server": "^1.12.1" | ||
} | ||
} |
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,21 @@ | ||
import React from 'react' | ||
import ReactTV, { Platform } from 'react-tv' | ||
|
||
class Clock extends React.Component { | ||
constructor() { | ||
super() | ||
this.state = { date: new Date() } | ||
} | ||
|
||
render() { | ||
if (Platform('webos')) { | ||
return ( | ||
<h1>It is {this.state.date.toLocaleTimeString()}</h1> | ||
) | ||
} | ||
|
||
return <h2>This App is available only at LG WebOS</h2> | ||
} | ||
} | ||
|
||
ReactTV.render(<Clock/>, document.getElementById('root')) |
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,13 @@ | ||
body { | ||
background: #262626; | ||
color: #4AD0EC; | ||
font-family: Helvetica; | ||
letter-spacing: 0.15em; | ||
width: 600px; | ||
margin: 0 auto; | ||
} | ||
|
||
h1 { | ||
font-weight: 300; | ||
color: #FFF; | ||
} |
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,19 @@ | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
|
||
module.exports = { | ||
entry: './src/App.js', | ||
output: { path: __dirname, filename: 'bundle.js' }, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /.jsx?$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules/, | ||
query: { | ||
presets: ['es2015', 'react'] | ||
} | ||
} | ||
] | ||
}, | ||
}; |
Oops, something went wrong.