File tree 4 files changed +105
-1
lines changed
4 files changed +105
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,57 @@ var React = require('react');
11
11
12
12
var TodoApp = require ( './components/TodoApp.react' ) ;
13
13
14
+ // Stuff from Axolotl example :D
15
+
16
+ // hack to show the labs page before its enabled...
17
+ // normally you would have a route to this page :D
18
+ if ( ! localStorage . axoVariations ) localStorage . axoVariations = '{show-labs-page: true}' ;
19
+
20
+ var Axo = require ( 'axolotl' ) ;
21
+
22
+ var variationRequire = require . context ( './variations' , true , / \. j s $ / ) ;
23
+ var availableVariations = variationRequire . keys ( ) . map ( ( v ) => variationRequire ( v ) . variation ) ;
24
+
25
+ var Axo = require ( 'axolotl' ) ;
26
+ var axo = new Axo ( availableVariations , undefined , Axo . localStorageActions ) ;
27
+
28
+ var LabsPage = Axo . LabsPage ;
29
+ var LabsVariation = require ( './variations/labs.js' ) ;
30
+
31
+ var AxoContext = React . createClass ( {
32
+ childContextTypes : {
33
+ axo : React . PropTypes . object . isRequired ,
34
+ } ,
35
+
36
+ getChildContext ( ) {
37
+ return {
38
+ axo : axo ,
39
+ } ;
40
+ } ,
41
+
42
+ getInitialState ( ) {
43
+ return {
44
+ showLabs : false ,
45
+ } ;
46
+ } ,
47
+
48
+ render ( ) {
49
+ return (
50
+ < div >
51
+ < LabsVariation onClick = { ( ) => this . setState ( { showLabs : ! this . state . showLabs } ) } />
52
+ { this . state . showLabs ?
53
+ < LabsPage />
54
+ :
55
+ < TodoApp />
56
+ }
57
+ </ div >
58
+ ) ;
59
+ }
60
+ } ) ;
61
+
62
+ // :D
63
+
14
64
React . render (
15
- < TodoApp /> ,
65
+ < AxoContext /> ,
16
66
document . getElementById ( 'todoapp' )
17
67
) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ var TodoTextInput = require('./TodoTextInput.react');
14
14
15
15
var classNames = require ( 'classnames' ) ;
16
16
17
+ // Axolotl Variation :D
18
+
19
+ var ROFLVariation = require ( '../variations/rofl' ) ;
20
+
21
+ // :D
22
+
17
23
var TodoItem = React . createClass ( {
18
24
19
25
propTypes : {
@@ -62,6 +68,7 @@ var TodoItem = React.createClass({
62
68
onChange = { this . _onToggleComplete }
63
69
/>
64
70
< label onDoubleClick = { this . _onDoubleClick } >
71
+ < ROFLVariation />
65
72
{ todo . text }
66
73
</ label >
67
74
< button className = "destroy" onClick = { this . _onDestroyClick } />
Original file line number Diff line number Diff line change
1
+ var React = require ( 'react' ) ;
2
+
3
+ var Axo = require ( 'axolotl' ) ;
4
+
5
+ var LabsPage = React . createClass ( {
6
+ render ( ) {
7
+ return (
8
+ < div >
9
+ < br />
10
+ < a href = "#" onClick = { this . props . onClick } > Toggle Labs Config</ a >
11
+ </ div >
12
+ ) ;
13
+ }
14
+ } ) ;
15
+
16
+
17
+ const LabsPageVariation = Axo . VariationEnhance ( {
18
+ Component : LabsPage ,
19
+ name : 'show-labs-page' ,
20
+ description : 'Add a link to configure the labs page' ,
21
+ visible : true , // allow users to opt in should they choose
22
+ } ) ;
23
+
24
+ module . exports = LabsPageVariation ;
Original file line number Diff line number Diff line change
1
+ var React = require ( 'react' ) ;
2
+
3
+ var Axo = require ( 'axolotl' ) ;
4
+
5
+ var ROFL = React . createClass ( {
6
+ render ( ) {
7
+ return (
8
+ < div >
9
+ < img style = { { width : 40 } } src = { `http://lorempixel.com/40/40/cats?${ Math . random ( ) } ` } />
10
+ </ div >
11
+ ) ;
12
+ }
13
+ } ) ;
14
+
15
+
16
+ const ROFLVariation = Axo . VariationEnhance ( {
17
+ Component : ROFL ,
18
+ name : 'rofl' ,
19
+ description : 'Put a cat on it' ,
20
+ visible : true , // allow users to opt in should they choose
21
+ } ) ;
22
+
23
+ module . exports = ROFLVariation ;
You can’t perform that action at this time.
0 commit comments