summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-09-28 19:26:51 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-09-28 19:26:51 (GMT)
commitea3ef4df505273827bf2c1e4eef5e9716e9746b0 (patch)
treeafd65e511c94d6b1df9602cdc4cf34d69c6f49f5
parent8ca2b1d7e9c6f142c2d89f33b41a164a0eadf702 (diff)
restructering components
-rw-r--r--package.json2
-rw-r--r--src/clockView.js14
-rw-r--r--src/component-clock.js33
-rw-r--r--www/index.html7
-rw-r--r--www/js/bundle.js21
-rw-r--r--www/js/components.js40
-rw-r--r--www/weeks.html1
7 files changed, 77 insertions, 41 deletions
diff --git a/package.json b/package.json
index 66cf23d..6bee47d 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"url": "https://git.helsinki.at/rhrdweb.git"
},
"scripts": {
- "build": "browserify -t [ babelify ] src/*.js -o www/js/bundle.js"
+ "build": "browserify -t [ babelify ] src/component-*.js -o www/js/components.js"
},
"dependencies": {
"babel-preset-react": "^6.11.1",
diff --git a/src/clockView.js b/src/clockView.js
deleted file mode 100644
index 61a13f4..0000000
--- a/src/clockView.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var ClockView = React.createClass({
- render: function() {
- return (
- <p>
- Hello, <input type="text" placeholder="Your name here" />!
- It is {this.props.date.toTimeString()}
- </p>
- );
- }
-});
-
-setInterval(function() {
- ReactDOM.render(<ClockView date={new Date()} />, document.getElementById('clock'));
-}, 500);
diff --git a/src/component-clock.js b/src/component-clock.js
new file mode 100644
index 0000000..fb877f4
--- /dev/null
+++ b/src/component-clock.js
@@ -0,0 +1,33 @@
+/*
+ * rhrdweb
+ *
+ * Copyright (C) 2016 Christian Pointner <equinox@helsinki.at>
+ *
+ * This file is part of rhrdweb.
+ *
+ * rhrdweb is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * rhrdweb is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with rhrdweb. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+var ClockView = React.createClass({
+ render: function() {
+ return (
+ <p>
+ Hello, <input type="text" placeholder="Your name here" />!
+ It is {this.props.date.toTimeString()}
+ </p>
+ );
+ }
+});
+
+// ReactDOM.render(<ClockView date={new Date()} />, document.getElementById('clock'));
diff --git a/www/index.html b/www/index.html
index 01704e1..5154cc6 100644
--- a/www/index.html
+++ b/www/index.html
@@ -11,14 +11,12 @@
<link href="/styles/common.css" rel="stylesheet">
<link href="/styles/main.css" rel="stylesheet">
- <script src="/javascript/react/react.js"></script>
- <script src="/javascript/react/react-dom.js"></script>
-<!--
<script src="/javascript/react/react.min.js"></script>
<script src="/javascript/react/react-dom.min.js"></script>
--->
+ <script src="/js/components.js"></script>
<script src="/javascript/jquery/jquery.min.js"></script>
<script src="/js/utils.js"></script>
+ <script src="/js/clock.js"></script>
</head>
<body>
<div id="container">
@@ -28,6 +26,5 @@
<div id="clock"></div>
</div>
- <script src="/js/bundle.js"></script>
</body>
</html>
diff --git a/www/js/bundle.js b/www/js/bundle.js
deleted file mode 100644
index 72bc450..0000000
--- a/www/js/bundle.js
+++ /dev/null
@@ -1,21 +0,0 @@
-(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
-var ClockView = React.createClass({
- displayName: "ClockView",
-
- render: function () {
- return React.createElement(
- "p",
- null,
- "Hello, ",
- React.createElement("input", { type: "text", placeholder: "Your name here" }),
- "! It is ",
- this.props.date.toTimeString()
- );
- }
-});
-
-setInterval(function () {
- ReactDOM.render(React.createElement(ClockView, { date: new Date() }), document.getElementById('clock'));
-}, 500);
-
-},{}]},{},[1]);
diff --git a/www/js/components.js b/www/js/components.js
new file mode 100644
index 0000000..86fa57c
--- /dev/null
+++ b/www/js/components.js
@@ -0,0 +1,40 @@
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+/*
+ * rhrdweb
+ *
+ * Copyright (C) 2016 Christian Pointner <equinox@helsinki.at>
+ *
+ * This file is part of rhrdweb.
+ *
+ * rhrdweb is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * rhrdweb is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with rhrdweb. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+var ClockView = React.createClass({
+ displayName: "ClockView",
+
+ render: function () {
+ return React.createElement(
+ "p",
+ null,
+ "Hello, ",
+ React.createElement("input", { type: "text", placeholder: "Your name here" }),
+ "! It is ",
+ this.props.date.toTimeString()
+ );
+ }
+});
+
+// ReactDOM.render(<ClockView date={new Date()} />, document.getElementById('clock'));
+
+},{}]},{},[1]);
diff --git a/www/weeks.html b/www/weeks.html
index 1b3f90c..c4265da 100644
--- a/www/weeks.html
+++ b/www/weeks.html
@@ -12,6 +12,7 @@
<script src="/javascript/react/react.min.js"></script>
<script src="/javascript/react/react-dom.min.js"></script>
+ <script src="/js/components.js"></script>
<script src="/javascript/jquery/jquery.min.js"></script>
<script src="/js/utils.js"></script>
<script src="/js/clock.js"></script>