diff --git a/assets/index.html b/assets/index.html
index ee7f7c8..bbcb609 100644
--- a/assets/index.html
+++ b/assets/index.html
@@ -61,6 +61,7 @@
#panel #content .link {
color: #2194CE;
+ display: block;
text-decoration: none;
cursor: pointer;
}
diff --git a/package.json b/package.json
index 9513e3e..506ee9c 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,8 @@
"cannon": "^0.6.2",
"react": "~15.3.1",
"react-dom": "^15.3.1",
+ "react-router": "^3.0.0-alpha.3",
+ "react-sizeme": "^2.1.3",
"react-three-renderer": "2.3.1",
"stats.js": "^1.0.0",
"three": "0.79.0"
diff --git a/src/examples/ExampleBrowser.js b/src/examples/ExampleBrowser.js
index 1ad3134..6ba3ab8 100644
--- a/src/examples/ExampleBrowser.js
+++ b/src/examples/ExampleBrowser.js
@@ -1,4 +1,6 @@
import React from 'react';
+import { Link } from 'react-router';
+import ExampleViewer from './ExampleViewer';
import SimpleExample from './Simple/index';
import ManualRenderingExample from './ManualRendering/index';
@@ -17,41 +19,49 @@ const examples = [
name: 'Simple',
component: SimpleExample,
url: 'Simple/index',
+ slug: 'webgl_simple',
},
{
name: 'Cloth',
component: ClothExample,
url: 'AnimationCloth/index',
+ slug: 'webgl_cloth',
},
{
name: 'Camera',
component: CameraExample,
url: 'WebGLCameraExample/index',
+ slug: 'webgl_camera',
},
{
name: 'Geometries',
component: GeometriesExample,
url: 'Geometries/index',
+ slug: 'webgl_geometries',
},
{
name: 'Geometry Shapes',
component: GeometryShapesExample,
url: 'GeometryShapes/index',
+ slug: 'webgl_geometry_shapes',
},
{
name: 'Draggable Cubes',
component: DraggableCubes,
url: 'DraggableCubes/index',
+ slug: 'webgl_draggable_cubes',
},
{
name: 'Physics',
component: Physics,
url: 'Physics/index',
+ slug: 'webgl_physics',
},
{
name: 'Physics - MousePick',
component: PhysicsMousePick,
url: 'Physics/mousePick',
+ slug: 'webgl_physics_mousepick',
},
{
separator: true,
@@ -66,6 +76,7 @@ const examples = [
name: 'Manual rendering',
component: ManualRenderingExample,
url: 'ManualRendering/index',
+ slug: 'advanced_manual_rendering',
},
{
separator: true,
@@ -75,74 +86,20 @@ const examples = [
name: 'RotatingCubes - Through React',
component: BenchmarkRotatingCubes,
url: 'Benchmark/RotatingCubes',
+ slug: 'benchmarks_rotating_cubes_react',
},
{
name: 'RotatingCubes - Direct Updates',
component: RotatingCubesDirectUpdates,
url: 'Benchmark/RotatingCubesDirectUpdates',
+ slug: 'benchmarks_rotating_cubes_direct',
},
];
-class ExampleBrowser extends React.Component {
- constructor(props, context) {
- super(props, context);
-
- this.state = {
- activeExample: null,
- viewerWidth: 0,
- viewerHeight: 0,
- };
- }
-
- componentDidMount() {
- window.addEventListener('resize', this._onWindowResize, false);
- }
-
- componentWillUnmount() {
- window.removeEventListener('resize', this._onWindowResize, false);
- }
-
- _onWindowResize = () => {
- const viewer = this.refs.viewer;
-
- this.setState({
- viewerWidth: viewer.offsetWidth,
- viewerHeight: viewer.offsetHeight,
- });
- };
-
- render() {
- let exampleContent = null;
-
- const {
- viewerWidth,
- viewerHeight,
- } = this.state;
-
- let sourceButton = null;
-
- if (this.state.activeExample !== null) {
- const {
- component: ExampleComponent,
- url,
- } = examples[this.state.activeExample];
-
- exampleContent = (