feat: add routing (#4)

This commit is contained in:
Ильназ 2024-10-27 16:07:03 +03:00
parent 855887079b
commit 693a7c5420
9 changed files with 98 additions and 6 deletions

View File

@ -9,7 +9,10 @@ module.exports = {
}, },
/* use https://admin.bro-js.ru/ to create config, navigations and features */ /* use https://admin.bro-js.ru/ to create config, navigations and features */
navigations: { navigations: {
"dry-wash-pl.main": "/dry-wash-pl", "dry-wash.main": "/dry-wash",
"dry-wash.create": "/order",
"dry-wash.view.order": "/order/:orderId",
"dry-wash.arm": "/arm",
}, },
features: { features: {
"dry-wash-pl": { "dry-wash-pl": {

41
package-lock.json generated
View File

@ -12,7 +12,8 @@
"@brojs/cli": "^1.3.0", "@brojs/cli": "^1.3.0",
"express": "^4.21.1", "express": "^4.21.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1" "react-dom": "^18.3.1",
"react-router-dom": "^6.27.0"
} }
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
@ -1869,6 +1870,14 @@
"node": ">=14" "node": ">=14"
} }
}, },
"node_modules/@remix-run/router": {
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.20.0.tgz",
"integrity": "sha512-mUnk8rPJBI9loFDZ+YzPGdeniYK+FTmRD1TMCz7ev2SNIozyKKpnGgsxO34u6Z4z/t0ITuu7voi/AshfsGsgFg==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
@ -5344,6 +5353,36 @@
} }
} }
}, },
"node_modules/react-router": {
"version": "6.27.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.27.0.tgz",
"integrity": "sha512-YA+HGZXz4jaAkVoYBE98VQl+nVzI+cVI2Oj/06F5ZM+0u3TgedN9Y9kmMRo2mnkSK2nCpNQn0DVob4HCsY/WLw==",
"dependencies": {
"@remix-run/router": "1.20.0"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"react": ">=16.8"
}
},
"node_modules/react-router-dom": {
"version": "6.27.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.27.0.tgz",
"integrity": "sha512-+bvtFWMC0DgAFrfKXKG9Fc+BcXWRUO1aJIihbB79xaeq0v5UzfvnM5houGUm1Y461WVRcgAQ+Clh5rdb1eCx4g==",
"dependencies": {
"@remix-run/router": "1.20.0",
"react-router": "6.27.0"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
}
},
"node_modules/readdirp": { "node_modules/readdirp": {
"version": "3.6.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",

View File

@ -17,6 +17,7 @@
"@brojs/cli": "^1.3.0", "@brojs/cli": "^1.3.0",
"express": "^4.21.1", "express": "^4.21.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1" "react-dom": "^18.3.1",
"react-router-dom": "^6.27.0"
} }
} }

View File

@ -1,9 +1,13 @@
import React from 'react'; import React from "react";
import { BrowserRouter } from "react-router-dom";
import Routers from "./routes";
const App = () => { const App = () => {
return ( return (
<h1>Сухой мастер </h1> <BrowserRouter>
<Routers></Routers>
</BrowserRouter>
); );
}; };
export default App; export default App;

7
src/pages/arm/index.tsx Normal file
View File

@ -0,0 +1,7 @@
import React from "react";
const Page = () => {
return <h1>Arm </h1>;
};
export default Page;

View File

@ -0,0 +1,7 @@
import React from "react";
const Page = () => {
return <h1>Landing</h1>;
};
export default Page;

View File

@ -0,0 +1,7 @@
import React from "react";
const Page = () => {
return <h1>Order form </h1>;
};
export default Page;

View File

@ -0,0 +1,7 @@
import React from "react";
const Page = () => {
return <h1>Order view</h1>;
};
export default Page;

17
src/routes.tsx Normal file
View File

@ -0,0 +1,17 @@
import React from "react";
import { Routes, Route } from "react-router-dom";
import Arm from "./pages/arm";
import Order from "./pages/order-view";
import Landing from "./pages/landing";
const Routers = () => {
return (
<Routes>
<Route path="/dry-wash-pl" element={<Landing />}></Route>
<Route path="/dry-wash-pl/order" element={<Order />}></Route>
<Route path="/dry-wash-pl/arm" element={<Arm />}></Route>
</Routes>
);
};
export default Routers;