1.4.0 • Published 1 year ago
keiron-sidebar v1.4.0
Keiron Sidebar
This library provides a sidebar component useful for all the suites
Setup
- In your front proyect run
yarn add keiron-sidebar
Example of use
import { Content, SideBar } from "keiron-sidebar"
import { Grid } from "@mui/material"
import { useRouter } from "next/router"
import { useAuth } from "common/context"
import { publicRoutes } from "common/config/constants"
export default function Layout({
children,
}: {
children: JSX.Element
}): JSX.Element {
const router = useRouter()
const { user, isLoading, logOut } = useAuth()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const route: any = []
const configRoutes = [
{
title: `Configuración`,
icon: `settings`,
path: ``,
subroutes: [
{
title: `Usuarios`,
icon: `person`,
path: `/users`,
},
{
title: `Aplicaciones`,
icon: `settings`,
path: `/applications`,
},
],
},
]
const configUserMenuList = [
{
icon: `settings`,
name: `Mi perfil`,
onClick: () => {
router.push(`/profile`)
},
},
]
const navigateFunction = (path: string): void => {
router.push(path)
}
if (!isLoading) {
if (user === null || publicRoutes.includes(router.pathname)) {
return children
}
}
const userInfo = {
firstName: user?.firstName || ``,
lastName: user?.lastName || ``,
roleName: user?.roles[0]?.name || ``,
photoUrl: user?.photoUrl || ``,
}
return (
<Grid container bgcolor={`background.common`}>
<SideBar
routes={route}
user={userInfo}
configRoutes={configRoutes}
navigateFunction={navigateFunction}
logoutFunction={logOut}
userMenuList={configUserMenuList}
/>
<Content>{children}</Content>
</Grid>
)
}
1.4.0
1 year ago
1.3.8
1 year ago
1.3.7
1 year ago
1.3.6
1 year ago
1.3.5
1 year ago
1.3.4
1 year ago
1.3.3
1 year ago
1.3.2
1 year ago
1.3.1
1 year ago
1.3.0
1 year ago
1.2.22
1 year ago
1.2.18
1 year ago
1.2.19
1 year ago
1.2.20
1 year ago
1.2.21
1 year ago
1.2.17
1 year ago
1.2.16
1 year ago
1.2.14
1 year ago
1.2.15
1 year ago
1.2.12
1 year ago
1.2.13
1 year ago
1.2.10
1 year ago
1.2.9
1 year ago
1.2.8
1 year ago
1.2.7
1 year ago
1.2.6
1 year ago
1.2.5
1 year ago
1.2.0
1 year ago
1.2.4
1 year ago
1.2.3
1 year ago
1.2.1
1 year ago
1.1.9
1 year ago
1.1.12
1 year ago
1.1.11
1 year ago
1.1.10
1 year ago
1.1.8
1 year ago
1.1.7
1 year ago
1.1.6
1 year ago
1.1.5
1 year ago
1.1.4
1 year ago
1.1.3
1 year ago
1.1.2
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago