@@ -2,8 +2,10 @@ import React, {Component} from 'react';
22import { hot } from 'react-hot-loader' ;
33import plotly from 'plotly.js/dist/plotly' ;
44import '../src/styles/main.scss' ;
5- import Nav from './Nav' ;
6- import PlotlyEditor from '../src' ;
5+ import 'react-select/dist/react-select.css' ;
6+ import ReactJson from 'react-json-view' ;
7+ import Select from 'react-select' ;
8+ import PlotlyEditor , { DefaultEditor , Panel } from '../src' ;
79
810// https://github.com/plotly/react-chart-editor#mapbox-access-tokens
911import ACCESS_TOKENS from '../accessTokens' ;
@@ -82,12 +84,43 @@ class App extends Component {
8284 useResizeHandler
8385 debug
8486 advancedTraceTypeSelector
85- />
86- < Nav
87- currentMockIndex = { this . state . currentMockIndex }
88- loadMock = { this . loadMock }
89- mocks = { this . state . mocks }
90- />
87+ >
88+ { ' ' }
89+ < DefaultEditor >
90+ < Panel group = "Dev" name = "JSON" >
91+ < Select
92+ clearable = { true }
93+ value = { this . state . currentMockIndex }
94+ name = "mock-dropdown"
95+ options = { this . state . mocks . map ( ( item , i ) => ( {
96+ label : item ,
97+ value : i ,
98+ } ) ) }
99+ searchable = { true }
100+ searchPromptText = "Search for a mock"
101+ onChange = { option => this . loadMock ( option . value ) }
102+ noResultsText = { 'No Results' }
103+ placeholder = { 'Search for a mock' }
104+ />
105+ < br />
106+ < ReactJson
107+ enableClipboard = { false }
108+ name = { false }
109+ displayDataTypes = { false }
110+ displayObjectSize = { false }
111+ indentWidth = { 2 }
112+ onAdd = { ( { updated_src} ) => this . setState ( updated_src ) }
113+ onEdit = { ( { updated_src} ) => this . setState ( updated_src ) }
114+ onDelete = { ( { updated_src} ) => this . setState ( updated_src ) }
115+ src = { {
116+ data : this . state . data ,
117+ layout : this . state . layout ,
118+ frames : this . state . frames ,
119+ } }
120+ />
121+ </ Panel >
122+ </ DefaultEditor >
123+ </ PlotlyEditor >
91124 </ div >
92125 ) ;
93126 }
0 commit comments