-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from JeanBaptisteWATENBERG/preview-json-path-ev…
…aluation-in-context Preview json path evaluation in context
- Loading branch information
Showing
18 changed files
with
630 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
sudo: false | ||
|
||
language: node_js | ||
node_js: | ||
- 8 | ||
|
||
- 8 | ||
before_install: | ||
- npm install codecov.io coveralls | ||
|
||
- npm install codecov.io coveralls | ||
after_success: | ||
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js | ||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js | ||
|
||
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js | ||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js | ||
- npm run docz:build | ||
branches: | ||
only: | ||
- master | ||
- master | ||
deploy: | ||
- provider: npm | ||
email: "[email protected]" | ||
on: | ||
branch: master | ||
api_key: | ||
secure: gpLMqNojmvhWMHWoskbjdNY053xujK8VbxiksEXj0b44eUvdGkiRnugeKEgaDPjBLl2vx9jjw+awQlUnNieWn+V3fFAq1BAAChJYR7kDD7Wl4hV2TiihXFWWwE89GdGggol5VbIsX+JZsCaPrrQnEjc6CFFSBBRdCLokGlURreT67cHb+n4kuwBalq5HX9Gvymdcpc4akWWhr73HQFT6hK4wpqsXU5TSvCe9jsHBjTTFmviLtUE3sLQB7iUG++2vLlSaRVqUx37ty5RSZgaPrvymMdb8xWMpCkdN+fr2fRSs/8YDy0eva4Vezcfjc5eBY7+LbEportVKp9JLaoyNvA0JJpUaHkGlOKTrfAIRVPfXJkk9IBxSqg+Lnse+RMKCU+eCN6W86EjLlvjREfpK8KkhWBqNBhg3ar0bcVm+7XQYp2FhXMrKK4KMK6PCQGyPr7ip7sbUJLJ5/zYraOq/s7vJuY1MqmJV2+QalYeWmD1+6iFOLlmQ4/hCwbp9Gdco7PHRX2flA2+Td1V++3rvRRLATfBQKosue00Bux1u1FSGIUTYGcSdHlTKZ0U0CsJXoUn0DnOOhwURdRsNK2t8j6R+CB4z0e0lIEqx4SG2+/+74FOJE7RuNi7+Us/By5g8a3fpbH/MSJ1cXlw5vrE4B88La4/tx4RMEUGAIU5R56U= | ||
- provider: surge | ||
project: .docz/dist | ||
domain: react-jsonpath-editor.surge.sh | ||
on: | ||
branch: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,72 @@ | ||
import React, {Component} from 'react' | ||
import {render} from 'react-dom' | ||
import React, {Component} from 'react'; | ||
import {render} from 'react-dom'; | ||
|
||
import JsonPathEditor from '../../src' | ||
import JsonPathEditor from '../../src'; | ||
import Previewer from '../../src/components/JsonPathPreviewer'; | ||
import { generateRandomJson } from './generateRandomJson'; | ||
|
||
|
||
class Demo extends Component { | ||
constructor(props) { | ||
super(props) | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
json: generateRandomJson(5) | ||
this.state = { | ||
json: generateRandomJson(5) | ||
}; | ||
} | ||
} | ||
|
||
render() { | ||
const {json} = this.state; | ||
return <div> | ||
<h1>react-jsonpath-editor Demo</h1> | ||
<h2>With a default json</h2> | ||
<JsonPathEditor/> | ||
<h2>With a random json and a default value <button onClick={() => this.setState({json: generateRandomJson(5)})}>Click here to generate a new input json</button></h2> | ||
<JsonPathEditor value='$' json={json}/> | ||
<h2>With a default value</h2> | ||
<JsonPathEditor value='$.store.book'/> | ||
</div> | ||
} | ||
render() { | ||
const {json} = this.state; | ||
return <div> | ||
<h1>react-jsonpath-editor Demo</h1> | ||
<h2>With a default json</h2> | ||
<JsonPathEditor/> | ||
<h2>With a random json and a default value <button onClick={() => this.setState({json: generateRandomJson(5)})}>Click here to generate a new input json</button></h2> | ||
<JsonPathEditor value='$' json={json}/> | ||
<h2>With a default value</h2> | ||
<JsonPathEditor value='$.store.book'/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<Previewer json={{ | ||
'store': { | ||
'book': [ | ||
{ | ||
'category': 'reference', | ||
'author': 'Nigel Rees', | ||
'title': 'Sayings of the Century', | ||
'price': 8.95 | ||
}, | ||
{ | ||
'category': 'fiction', | ||
'author': 'Evelyn Waugh', | ||
'title': 'Sword of Honour', | ||
'price': 12.99 | ||
}, | ||
{ | ||
'category': 'fiction', | ||
'author': 'Herman Melville', | ||
'title': 'Moby Dick', | ||
'isbn': '0-553-21311-3', | ||
'price': 8.99 | ||
}, | ||
{ | ||
'category': 'fiction', | ||
'author': 'J. R. R. Tolkien', | ||
'title': 'The Lord of the Rings', | ||
'isbn': '0-395-19395-8', | ||
'price': 22.99 | ||
} | ||
], | ||
'bicycle': { | ||
'color': 'red', | ||
'price': 19.95 | ||
} | ||
} | ||
}} jsonPath='$.store' /> | ||
|
||
</div>; | ||
} | ||
} | ||
|
||
render(<Demo/>, document.querySelector('#demo')) | ||
render(<Demo/>, document.querySelector('#demo')); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
name: react-json-path-previewer | ||
route: /json-path-previewer | ||
--- | ||
|
||
import { Playground, PropsTable } from 'docz' | ||
import { JsonPathPreviewer } from './'; | ||
|
||
# React JSON Path previewer | ||
|
||
<PropsTable of={JsonPathPreviewer} /> | ||
|
||
## Basic usage | ||
|
||
<Playground> | ||
<JsonPathPreviewer | ||
jsonPath='$..author' | ||
json={{ | ||
'store': { | ||
'book': [ | ||
{ | ||
'category': 'reference', | ||
'author': 'Nigel Rees', | ||
'title': 'Sayings of the Century', | ||
'price': 8.95 | ||
}, | ||
{ | ||
'category': 'fiction', | ||
'author': 'Evelyn Waugh', | ||
'title': 'Sword of Honour', | ||
'price': 12.99 | ||
}, | ||
{ | ||
'category': 'fiction', | ||
'author': 'Herman Melville', | ||
'title': 'Moby Dick', | ||
'isbn': '0-553-21311-3', | ||
'price': 8.99 | ||
}, | ||
{ | ||
'category': 'fiction', | ||
'author': 'J. R. R. Tolkien', | ||
'title': 'The Lord of the Rings', | ||
'isbn': '0-395-19395-8', | ||
'price': 22.99 | ||
} | ||
], | ||
'bicycle': { | ||
'color': 'red', | ||
'price': 19.95 | ||
} | ||
} | ||
}}/> | ||
</Playground> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.highlighted { | ||
color: green; | ||
font-weight: bold; | ||
} | ||
|
||
code { | ||
color: #777; | ||
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; | ||
} | ||
|
||
code p { | ||
margin: 0; | ||
} |
Oops, something went wrong.