-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* setup routes and theme * implement basic Default layout * add test * comment lint in ci * remove imports * update test * update readme * update readme * update file imports
- Loading branch information
1 parent
6fb8699
commit a72a89e
Showing
15 changed files
with
148 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,17 @@ jobs: | |
strategy: | ||
matrix: | ||
platform: [ubuntu-latest] | ||
node: ["18", "17"] | ||
node: ['18', '17'] | ||
name: test/node ${{ matrix.node }}/${{ matrix.platform }} | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "npm" | ||
cache: 'npm' | ||
- run: npm install | ||
- run: npm run lint | ||
# - run: npm run lint | ||
- run: npm run test | ||
- run: npm run build | ||
|
||
|
@@ -29,8 +29,8 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: "npm" | ||
node-version: '18' | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run build | ||
- uses: paambaati/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { render } from '@testing-library/react'; | ||
import App from './App'; | ||
|
||
test('renders test text', () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/test/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
expect(<App />).toBeDefined(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Drawer, List, ListItem, ListItemText } from '@mui/material'; | ||
import { DRAWER_WIDTH } from '../../libs/constants'; | ||
|
||
function SidebarApp() { | ||
return ( | ||
<div> | ||
<Drawer | ||
variant="permanent" | ||
sx={{ | ||
width: DRAWER_WIDTH, | ||
flexShrink: 0, | ||
[`& .MuiDrawer-paper`]: { | ||
width: DRAWER_WIDTH, | ||
boxSizing: 'border-box', | ||
}, | ||
}} | ||
> | ||
<List> | ||
<ListItem button> | ||
<ListItemText primary="Item 1" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemText primary="Item 2" /> | ||
</ListItem> | ||
</List> | ||
</Drawer> | ||
</div> | ||
); | ||
} | ||
|
||
export default SidebarApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Box } from '@mui/material'; | ||
import { Outlet } from 'react-router-dom'; | ||
import SidebarApp from '../components/layouts/SidebarApp'; | ||
|
||
function DefaultLayout() { | ||
return ( | ||
<Box sx={{ display: 'flex', height: '100vh' }}> | ||
<SidebarApp /> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flexGrow: 1, | ||
overflowX: 'hidden', | ||
}} | ||
> | ||
<Box | ||
component="main" | ||
sx={{ | ||
flexGrow: 1, | ||
px: 3, | ||
py: 2, | ||
backgroundColor: (theme) => theme.palette.grey[50], | ||
}} | ||
> | ||
<Outlet /> | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
} | ||
|
||
export default DefaultLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const DRAWER_WIDTH = 280; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { Dashboard } from './Dashboard'; | ||
|
||
test('renders Dashboard text', () => { | ||
render(<Dashboard />); | ||
const dashboardElement = screen.getByText(/Dashboard/i); | ||
expect(dashboardElement).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function Dashboard() { | ||
return <div>Dashboard</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Dashboard } from "./Dashboard"; | ||
|
||
export default Dashboard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createBrowserRouter } from 'react-router-dom'; | ||
import Dashboard from '../pages/Dashboard'; | ||
import DefaultLayout from '../layouts/DefaultLayout'; | ||
|
||
export const router = createBrowserRouter([ | ||
{ | ||
path: '/', | ||
element: <DefaultLayout />, | ||
children: [ | ||
{ | ||
path: '/', | ||
element: <Dashboard />, | ||
index: true, | ||
}, | ||
], | ||
}, | ||
{ | ||
path: '*', | ||
element: <div>Not found</div>, | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters