diff --git a/package.json b/package.json index ed507d1..63f5909 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ }, "dependencies": { "axios": "^1.5.0", - "preact": "^10.16.0" + "preact": "^10.16.0", + "react-router-dom": "^6.16.0" }, "devDependencies": { "@preact/preset-vite": "^2.5.0", diff --git a/src/app.tsx b/src/app.tsx index 049ef5d..3fa7dea 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,11 +1,26 @@ +import { Route, Routes } from 'react-router-dom' +import { BrowserRouter as Router } from 'react-router-dom' import './app.css' -import { Home } from './pages' - +import { DefaultLayout } from './layouts' +import routes from './routes' export function App() { - return ( <> - + + + }> + {routes.map(({ path, name, element}) => ( + <> + + + ))} + + + ) } diff --git a/src/components/Header/style.css b/src/components/Header/style.css index 40d16e8..4b13d58 100644 --- a/src/components/Header/style.css +++ b/src/components/Header/style.css @@ -114,9 +114,4 @@ label:before { /* display: 'inline-block'; max-width: '100%'; text-align: 'center'; */ -} - -.navLink:hover{ - border-bottom-width: 2px; - margin-bottom: -2px; } \ No newline at end of file diff --git a/src/constants/api.ts b/src/constants/api.ts new file mode 100644 index 0000000..0053020 --- /dev/null +++ b/src/constants/api.ts @@ -0,0 +1,16 @@ +const BASE_URL = "http://localhost:8888" + +const SIGNUP_URI = `${BASE_URL}/user/signup` + + +const GET_LIST_LOCATIONS_URI = `${BASE_URL}/locations`; +const GET_LIST_RECENT_LOCATIONS_RATING_URI = `${BASE_URL}/recent-locations/ratings` +const GET_LOCATION_URI = `${BASE_URL}/location`; + +export { + BASE_URL, + GET_LIST_RECENT_LOCATIONS_RATING_URI, + GET_LIST_LOCATIONS_URI, + GET_LOCATION_URI, + SIGNUP_URI +} \ No newline at end of file diff --git a/src/layouts/Default/Default.tsx b/src/layouts/Default/Default.tsx index 7b93943..4b7b885 100644 --- a/src/layouts/Default/Default.tsx +++ b/src/layouts/Default/Default.tsx @@ -1,16 +1,13 @@ import { ComponentChildren } from "preact"; import { Footer, Header } from "../../components"; +import { Outlet } from "react-router-dom"; -type ChildrenProps = { - children: ComponentChildren -} - -function DefaultLayout({ children }: ChildrenProps) { +function DefaultLayout() { return ( <>
- {children} +