Skip to content

Commit a444480

Browse files
author
Guy
committed
Merge branch 'master' of github.com:HubSpot/react-experiments
2 parents b8205a9 + d5f8214 commit a444480

File tree

3 files changed

+40
-22
lines changed

3 files changed

+40
-22
lines changed

examples/index.html

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
<head>
33
<meta charset="UTF-8">
44
<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'>
57
</head>
68
<body>
79
<div class="examples-container"></div>
8-
910
<script src="http://cdn.jsdelivr.net/react/0.13.3/react-with-addons.js"></script>
1011
<script src="http://cdn.jsdelivr.net/react/0.13.3/JSXTransformer.js"></script>
1112
<script src="../node_modules/planout/dist/planout.js"></script>
@@ -88,17 +89,20 @@
8889
var VariationExperiment = React.createClass({
8990
render: function() {
9091
return (
92+
<div className="card">
93+
<span>A single branch is rendered conditionally: </span>
9194
<ReactExperiments.ABTest experiment={window.demo} experimentName='SampleExperiment' on='foo'>
9295
<ReactExperiments.When value='Variation A'>
93-
Variation A
96+
<strong>Variation A Component</strong>
9497
</ReactExperiments.When>
9598
<ReactExperiments.When value='Variation B'>
96-
Variation B
99+
<strong>Variation B Component</strong>
97100
</ReactExperiments.When>
98101
<ReactExperiments.Default>
99-
test
102+
<strong>Default Component</strong>
100103
</ReactExperiments.Default>
101104
</ReactExperiments.ABTest>
105+
</div>
102106
);
103107
}
104108
});
@@ -110,22 +114,19 @@
110114

111115
render: function() {
112116
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>
117120
);
118121
}
119122
});
120123

121124
var TextComponent = React.createClass({
122125
render: function() {
123126
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>
129130
);
130131
}
131132
});
@@ -137,6 +138,7 @@
137138
return (
138139
<ReactExperiments.Parametrize experiment={window.demo}>
139140
<TextComponent />
141+
<FooComponent />
140142
</ReactExperiments.Parametrize>
141143
);
142144
}
@@ -145,15 +147,18 @@
145147
var ExperimentExamples = React.createClass({
146148
render: function() {
147149
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>
157162
</div>
158163
);
159164
}

examples/react-experiments.jpg

36 KB
Loading

examples/styles.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
body {background: whitesmoke;color: #282828;font-family: 'Roboto', sans-serif;font-weight: 400;}
2+
img {max-width: 100%;}
3+
.wrap {width: 100%;max-width: 600px;margin: 0 auto;}
4+
.clearfix {clear: both;}
5+
.text-center {text-align: center;}
6+
.text-left {text-align: left;}
7+
.text-right {text-align: right;}
8+
.margin-top {margin-top: 20px;}
9+
.margin-bottom {margin-bottom: 20px;}
10+
.card {margin: 0 0 10px 0;padding: 20px;background: white;border: 1px solid gainsboro;border-radius: 4px;}
11+
.example {margin: 20px 0;}
12+
.logo {margin: 20px 0;padding-bottom: 40px;border-bottom: 1px solid gainsboro;}
13+
.user-id {color: #999;font-size: 13px;}

0 commit comments

Comments
 (0)