Skip to content

Commit 9f31a14

Browse files
Berkeley MartinezBerkeley Martinez
authored andcommitted
codemirror should get initial value from bonfire
1 parent 6bf2b0e commit 9f31a14

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

common/components/bonfires/Bonfires.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var Bonfire = React.createClass({
4444
render: function() {
4545
var {
4646
name,
47+
challengeSeed,
4748
difficulty,
4849
description
4950
} = this.state;
@@ -64,7 +65,7 @@ var Bonfire = React.createClass({
6465
<Col
6566
xs={ 12 }
6667
md={ 8 }>
67-
<Editor value='This is code console.log(x)'/>
68+
<Editor value={ challengeSeed }/>
6869
</Col>
6970
</Row>
7071
</Grid>

common/components/bonfires/Store.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var BonfiresStore = Store.create({
55

66
getInitialValue: function() {
77
return {
8+
challengeSeed: 'initial seed',
89
difficulty: 0,
910
description: [
1011
'default state'
@@ -19,9 +20,10 @@ var BonfiresStore = Store.create({
1920

2021
return [
2122
setBonfire
22-
.map(function({ name, description, difficulty}) {
23+
.map(function({ name, challengeSeed, description, difficulty}) {
2324
return {
2425
name,
26+
challengeSeed,
2527
description,
2628
difficulty
2729
};

common/components/editor/Editor.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ var Editor = React.createClass({
1111

1212
getDefaultProps: function() {
1313
return {
14-
value: 'console.log(\'awesome\')'
14+
value: 'console.log(\'freeCodeCamp is awesome\')'
1515
};
1616
},
1717

1818
getInitialState: function() {
1919
return {
20-
CodeMirrorValue: ''
20+
CodeMirrorValue: this.props.value
2121
};
2222
},
2323

0 commit comments

Comments
 (0)