|
2 | 2 | <head>
|
3 | 3 | <meta charset="UTF-8">
|
4 | 4 | <title>react-experiments example</title>
|
| 5 | + <link rel="stylesheet" type="text/css" href="./styles.css" /> |
| 6 | + <link href='https://fonts.googleapis.com/css?family=Roboto:400,300italic,300,400italic,500,500italic,700,700italic' rel='stylesheet' type='text/css'> |
5 | 7 | </head>
|
6 | 8 | <body>
|
7 | 9 | <div class="examples-container"></div>
|
8 |
| - |
9 | 10 | <script src="http://cdn.jsdelivr.net/react/0.13.3/react-with-addons.js"></script>
|
10 | 11 | <script src="http://cdn.jsdelivr.net/react/0.13.3/JSXTransformer.js"></script>
|
11 | 12 | <script src="../node_modules/planout/dist/planout.js"></script>
|
|
88 | 89 | var VariationExperiment = React.createClass({
|
89 | 90 | render: function() {
|
90 | 91 | return (
|
| 92 | + <div className="card"> |
| 93 | + <span>A single branch is rendered conditionally: </span> |
91 | 94 | <ReactExperiments.ABTest experiment={window.demo} experimentName='SampleExperiment' on='foo'>
|
92 | 95 | <ReactExperiments.When value='Variation A'>
|
93 |
| - Variation A |
| 96 | + <strong>Variation A Component</strong> |
94 | 97 | </ReactExperiments.When>
|
95 | 98 | <ReactExperiments.When value='Variation B'>
|
96 |
| - Variation B |
| 99 | + <strong>Variation B Component</strong> |
97 | 100 | </ReactExperiments.When>
|
98 | 101 | <ReactExperiments.Default>
|
99 |
| - test |
| 102 | + <strong>Default Component</strong> |
100 | 103 | </ReactExperiments.Default>
|
101 | 104 | </ReactExperiments.ABTest>
|
| 105 | + </div> |
102 | 106 | );
|
103 | 107 | }
|
104 | 108 | });
|
|
110 | 114 |
|
111 | 115 | render: function() {
|
112 | 116 | return (
|
113 |
| - <span> |
114 |
| - This is passed down by context: |
115 |
| - {this.context.experimentParameters.foo} |
116 |
| - </span> |
| 117 | + <div className="card"> |
| 118 | + Experiment param value passed down via context: <strong>{this.context.experimentParameters.foo}</strong> |
| 119 | + </div> |
117 | 120 | );
|
118 | 121 | }
|
119 | 122 | });
|
120 | 123 |
|
121 | 124 | var TextComponent = React.createClass({
|
122 | 125 | render: function() {
|
123 | 126 | return (
|
124 |
| - <span> |
125 |
| - This is passed down by props: {this.props.foo} |
126 |
| - <br /> |
127 |
| - <FooComponent /> |
128 |
| - </span> |
| 127 | + <div className="card"> |
| 128 | + Experiment param value passed down via props: <strong>{this.props.foo}</strong> |
| 129 | + </div> |
129 | 130 | );
|
130 | 131 | }
|
131 | 132 | });
|
|
137 | 138 | return (
|
138 | 139 | <ReactExperiments.Parametrize experiment={window.demo}>
|
139 | 140 | <TextComponent />
|
| 141 | + <FooComponent /> |
140 | 142 | </ReactExperiments.Parametrize>
|
141 | 143 | );
|
142 | 144 | }
|
|
145 | 147 | var ExperimentExamples = React.createClass({
|
146 | 148 | render: function() {
|
147 | 149 | return (
|
148 |
| - <div> |
149 |
| - <span>Your user id is {window.userid}</span> |
150 |
| - <br /> |
151 |
| - <span>This is an experiment just using the parametrize component</span> |
152 |
| - <br /> |
153 |
| - <ParametrizeExperiment /> |
154 |
| - <br /> |
155 |
| - <span>This is an experiment using the ABTest component</span> |
156 |
| - <VariationExperiment /> |
| 150 | + <div className="wrap"> |
| 151 | + <div className="logo text-center"> |
| 152 | + <img src="./react-experiments.jpg" width="400" /> |
| 153 | + </div> |
| 154 | + <div className="example"> |
| 155 | + <h3>Parametrize Component:</h3> |
| 156 | + <ParametrizeExperiment /> |
| 157 | + </div> |
| 158 | + <div className="example"> |
| 159 | + <h3>ABTest Component:</h3> |
| 160 | + <VariationExperiment /> |
| 161 | + </div> |
157 | 162 | </div>
|
158 | 163 | );
|
159 | 164 | }
|
|
0 commit comments