diff --git a/components/ConversionPanel.js b/components/ConversionPanel.js
index c7d0722..64e8722 100644
--- a/components/ConversionPanel.js
+++ b/components/ConversionPanel.js
@@ -45,7 +45,6 @@ export default class ConversionPanel extends PureComponent {
}
componentDidMount () {
- const {name} = this.props
const code = this.props.url.query.code || this.props.defaultText
this.setState({
value: code,
@@ -53,11 +52,6 @@ export default class ConversionPanel extends PureComponent {
})
}
- shouldComponentUpdate(nextProps, nextState) {
- console.log(nextProps, this.props, nextState)
- return true
- }
-
onChange = (newValue) => {
try {
const code = this.props.getTransformedValue(newValue)
diff --git a/components/Layout.js b/components/Layout.js
index 9123602..3b50ce5 100644
--- a/components/Layout.js
+++ b/components/Layout.js
@@ -153,7 +153,7 @@ export default function ({children, pathname}) {
- - JS Object to React PropTypes
+ - JSON to React PropTypes
- JSON to Flow Types
- JSON to Typescript Interface
- CSS to JS Objects
diff --git a/pages/css-to-js.js b/pages/css-to-js.js
index 25d56a0..ff0ebb6 100644
--- a/pages/css-to-js.js
+++ b/pages/css-to-js.js
@@ -1,5 +1,4 @@
import React, { PureComponent } from 'react'
-import dynamic from 'next/dynamic'
import plugin from '../utils/css-to-js'
import Layout from '../components/Layout'
import ConversionPanel from '../components/ConversionPanel'
diff --git a/pages/index.js b/pages/index.js
index 24354ae..5529831 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -2,24 +2,13 @@ import React, { PureComponent } from 'react'
import plugin from '../utils/babel-plugin-js-to-prop-types'
import Layout from '../components/Layout'
import { transform } from 'babel-standalone'
+import defaultText from '../utils/dummy-json'
import ConversionPanel from '../components/ConversionPanel'
-const defaultText = `// Enter the object you want to convert in the
-// following form
-//
-// const x = your_object
-//
-// You need to assign your object to a variable (for now.)
-
-const x = {
- foo: 'bar',
- ids: [1, 2, 3]
-}
-`
-
export default class Main extends PureComponent {
getTransformedValue = (newValue) => {
+ newValue = 'const propTypes = ' + newValue
const {code} = transform(newValue, {
presets: ['es2015'],
plugins: [plugin]
@@ -32,6 +21,7 @@ export default class Main extends PureComponent {
{
diff --git a/pages/json-to-ts-interface.js b/pages/json-to-ts-interface.js
index 5e17dd6..5e41f69 100644
--- a/pages/json-to-ts-interface.js
+++ b/pages/json-to-ts-interface.js
@@ -3,17 +3,7 @@ import dynamic from 'next/dynamic'
import { Json2dts, toValidJSON } from '../utils/json-to-ts-flow'
import Layout from '../components/Layout'
import ConversionPanel from '../components/ConversionPanel'
-
-const defaultText = `
-{
- "foo": "bar",
- "ids": [1, 2, 3],
- "hello": {
- "x": "lkjlj",
- "y": "kjhkjhkjh"
- }
-}
-`
+import defaultText from '../utils/dummy-json'
export default class Json2Ts extends PureComponent {
getTransformedValue = (newValue) => {
diff --git a/utils/dummy-json.js b/utils/dummy-json.js
new file mode 100644
index 0000000..130d4bd
--- /dev/null
+++ b/utils/dummy-json.js
@@ -0,0 +1,46 @@
+const x = `
+{
+ "hello": [
+ {
+ "_id": "5988946e45e52d60b33a25c7",
+ "latitude": 50.087977,
+ "longitude": 72.167197,
+ "tags": [
+ "nulla",
+ "ullamco"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Robinson Woods"
+ },
+ {
+ "id": 1,
+ "name": "Lottie Hogan"
+ }
+ ]
+ },
+ {
+ "_id": "5988946ef6090217857d7b0f",
+ "latitude": 47.460772,
+ "longitude": 85.95137,
+ "tags": [
+ "aliqua",
+ "nulla"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mamie Wyatt"
+ },
+ {
+ "id": 1,
+ "name": "Alejandra Mcdaniel"
+ }
+ ]
+ }
+ ]
+}
+ `
+
+export default x
\ No newline at end of file