diff --git a/src/settings.jsx b/src/settings.jsx
index 85986ca5..c1d6ab20 100644
--- a/src/settings.jsx
+++ b/src/settings.jsx
@@ -1,25 +1,18 @@
import React from 'react'
import theme from './theme.js'
import { Heading, Container, Input, Toolbar, NavItem, Space } from 'rebass'
+import Immutable from 'immutable'
/** Edit global settings within a style such as the name */
export class SettingsEditor extends React.Component {
static propTypes = {
- mapStyle: React.PropTypes.object.isRequired
+ mapStyle: React.PropTypes.instanceOf(Immutable.Map).isRequired,
+ onStyleChanged: React.PropTypes.func.isRequired
}
- constructor(props) {
- super(props)
- this.state = {
- settings: this.props.styleManager.settings()
- }
- }
-
onChange(property, e) {
- let settings = this.state.settings
- settings[property] = e.target.value
- this.props.styleManager[property] = settings[property]
- this.setState(settings)
+ const changedStyle = this.props.mapStyle.set(property, e.target.value)
+ this.props.onStyleChanged(changedStyle)
}
render() {
@@ -33,25 +26,25 @@ export class SettingsEditor extends React.Component {