Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Debug from 'debug'
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
import ImageToolDemo from './src/ImageToolDemo'
import HotspotImageDemo from './src/HotspotImageDemo'
import history from './src/history'
import {createRoute, createScope, RouterProvider, RouteScope, StateLink} from '@sanity/state-router'
import IMAGES from './src/data/testImages'
Debug.disable('')
Debug.enable(process.env.DEBUG)
const DEFAULT_IMAGE_INDEX = 4
const routes = createRoute('/*', [
createRoute('/:demoName/*', params => {
return params.demoName ? createScope(params.demoName, createRoute('/:imageIndex')) : []
})
])
class Root extends React.Component {
static contextTypes = {
router: PropTypes.object
}
renderDemo(demoName) {
const routerState = this.context.router.state
const demoParams = routerState[demoName] || {}
if (demoName === 'hotspotimage') {
return
}
if (demoName === 'imagetool') {
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
import ImageToolDemo from './src/ImageToolDemo'
import HotspotImageDemo from './src/HotspotImageDemo'
import history from './src/history'
import {createRoute, createScope, RouterProvider, RouteScope, StateLink} from '@sanity/state-router'
import IMAGES from './src/data/testImages'
Debug.disable('')
Debug.enable(process.env.DEBUG)
const DEFAULT_IMAGE_INDEX = 4
const routes = createRoute('/*', [
createRoute('/:demoName/*', params => {
return params.demoName ? createScope(params.demoName, createRoute('/:imageIndex')) : []
})
])
class Root extends React.Component {
static contextTypes = {
router: PropTypes.object
}
renderDemo(demoName) {
const routerState = this.context.router.state
const demoParams = routerState[demoName] || {}
if (demoName === 'hotspotimage') {
return
}
if (demoName === 'imagetool') {
return
createRoute('/:demoName/*', params => {
return params.demoName ? createScope(params.demoName, createRoute('/:imageIndex')) : []
})
])