Add routing

This commit is contained in:
2025-02-17 21:23:38 +01:00
parent b6c7edecfd
commit 1cbcb8ce4c
11 changed files with 119 additions and 5 deletions
+3
View File
@@ -0,0 +1,3 @@
.container {
text-align: left;
}
+11
View File
@@ -0,0 +1,11 @@
import './index.css';
function Home() {
return (
<div className='container'>
<h1>Home</h1>
</div>
);
}
export default Home;
+3
View File
@@ -0,0 +1,3 @@
.container {
text-align: left;
}
+11
View File
@@ -0,0 +1,11 @@
import './index.css';
function Languages() {
return (
<div className='container'>
<h1>Languages</h1>
</div>
);
}
export default Languages;
+3
View File
@@ -0,0 +1,3 @@
.container {
text-align: left;
}
+11
View File
@@ -0,0 +1,11 @@
import './index.css';
function NotFound() {
return (
<div className='container'>
<h1>Not Found</h1>
</div>
);
}
export default NotFound;
+3 -1
View File
@@ -6,8 +6,10 @@ import Code from 'components/Code';
import Stats from 'components/Stats';
import './index.css';
import { useParams } from 'react-router';
function Typing() {
const {lang} = useParams();
const [code, setCode] = useState<string>('');
const [loaded, setLoaded] = useState<boolean>(false);
@@ -16,7 +18,7 @@ function Typing() {
setCode('');
const response = await fetch(
`${import.meta.env.VITE_API_URL}/generate?lang=lisp`,
`${import.meta.env.VITE_API_URL}/generate?lang=${lang}`,
);
if (!response.ok || !response.body) return;