Skip to content

Commit

Permalink
setup routes and theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-torabiv committed Jul 9, 2024
1 parent 8692fcc commit 865d6b7
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import React from "react";
import "./App.css";
import { RouterProvider } from "react-router-dom";
import { router } from "./router";

function App() {
return <>test</>;
return (
<>
<RouterProvider router={router} />
</>
);
}

export default App;
10 changes: 10 additions & 0 deletions src/libs/theme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createTheme } from '@mui/material/styles';

const theme = createTheme({
palette: {},
typography: {
fontFamily: ['DM Sans', 'sans-serif'].join(','),
},
});

export default theme;
9 changes: 6 additions & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import { BrowserRouter } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import theme from "./libs/theme.tsx";

import '@fontsource/roboto/300.css';
import '@fontsource/roboto/400.css';
Expand All @@ -23,9 +25,10 @@ const queryClient = new QueryClient({
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<ThemeProvider theme={theme}>
<CssBaseline />
<App />
</BrowserRouter>
</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>,
);
8 changes: 8 additions & 0 deletions src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'

export const Dashboard = () => {
return (
<div>Dashboard</div>
)
}

3 changes: 3 additions & 0 deletions src/pages/Dashboard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Dashboard } from "./Dashboard";

export default Dashboard;
14 changes: 14 additions & 0 deletions src/router/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { createBrowserRouter } from 'react-router-dom';
import Dashboard from '@/pages/Dashboard';

export const router = createBrowserRouter([
{
path: '/',
element: <Dashboard />,
},
{
path: '*',
element: <div>Not found</div>,
},
]);
10 changes: 7 additions & 3 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react",
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src", ".eslintrc.cjs"]
"include": ["src", ".eslintrc.cjs", "src/setupTests.ts"]
}
4 changes: 4 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -19,4 +20,7 @@ export default defineConfig({
server: {
port: 3000,
},
resolve: {
alias: { "@": path.resolve(__dirname, "/src") },
},
});

0 comments on commit 865d6b7

Please sign in to comment.