Skip to content

Commit

Permalink
feat(admin): changed toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeffer committed Dec 10, 2023
1 parent 0286ef6 commit 1a63ad3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/components/Admin/Admin.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {FC} from 'react'
import {Admin as ReactAdmin, Resource} from 'react-admin'

import {AdminLayout} from './AdminLayout'
import {dataProvider} from './dataProvider'
import {AdminLayout} from './layout'
import {FlatpageCreate} from './resources/base/flat-page/FlatpageCreate'
import {FlatpageEdit} from './resources/base/flat-page/FlatpageEdit'
import {FlatpageList} from './resources/base/flat-page/FlatpageList'
Expand Down
39 changes: 39 additions & 0 deletions src/components/Admin/AdminLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {Home, Logout} from '@mui/icons-material/'
import {Button, Stack, Typography} from '@mui/material'
import {useRouter} from 'next/router'
import {AppBar, Layout, LayoutProps, useLogout} from 'react-admin'

const AppMenuBar = () => {
const router = useRouter()
const logout = useLogout()

return (
<>
<AppBar
userMenu={false}
position="relative"
toolbar={
<Stack gap={2} direction="row">
<Button color="inherit" onClick={() => router.push('/')}>
<Stack gap={1} direction="row">
<Home />
<Typography variant="body1">Späť na hlavnú stránku</Typography>
</Stack>
</Button>

<Button color="inherit" onClick={() => logout(null, '../../', false)}>
<Stack gap={1} direction="row">
<Logout />
<Typography variant="body1">Odhlásiť</Typography>
</Stack>
</Button>
</Stack>
}
/>
</>
)
}

export const AdminLayout = (props: LayoutProps) => {
return <Layout {...props} appBar={AppMenuBar} />
}
25 changes: 0 additions & 25 deletions src/components/Admin/layout.tsx

This file was deleted.

0 comments on commit 1a63ad3

Please sign in to comment.