Skip to content

Commit

Permalink
use hash router
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Henderson committed Oct 26, 2023
1 parent 85832ff commit b943f3f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# smoothstep

[view animations at matthen.github.io/smoothstep](https://matthen.github.io/smoothstep/).

Animations are built automatically using github actions: [![deploy-pages](https://github.com/matthen/smoothstep/actions/workflows/deploy-pages.yaml/badge.svg?branch=main)](https://github.com/matthen/smoothstep/actions/workflows/deploy-pages.yaml).

A collection of mathematical animations, written as small React components.

- [animations](src/animations) - code for each animation
Expand Down
29 changes: 13 additions & 16 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { Link, RouterProvider, createBrowserRouter } from 'react-router-dom';
import { Link, RouterProvider, createHashRouter } from 'react-router-dom';

import Hypocycloids from './animations/hypocycloids';
import './index.css';
Expand Down Expand Up @@ -30,21 +30,18 @@ const AnimationList = () => {
);
};

const router = createBrowserRouter(
[
{
path: '/',
element: <AnimationList />,
},
...animations.map((animation) => {
return {
path: `/${animation.name}`,
element: <animation.component />,
};
}),
],
{ basename: '/smoothstep' },
);
const router = createHashRouter([
{
path: '/',
element: <AnimationList />,
},
...animations.map((animation) => {
return {
path: `/${animation.name}`,
element: <animation.component />,
};
}),
]);

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
Expand Down

0 comments on commit b943f3f

Please sign in to comment.