Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3249 | Rev 3253 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3201 stevensc 1
import React from 'react'
3246 stevensc 2
import { Outlet, useMatch } from 'react-router-dom'
3
 
3201 stevensc 4
import { Grid } from '@mui/material'
5
 
3246 stevensc 6
import Menu from '@components/habits/HabitsMenu'
3218 stevensc 7
import HabitsUrlsProvider from '@providers/habits/habitsUrls'
3201 stevensc 8
 
9
import './habits.css'
10
 
11
export default function HabitsLayout() {
3247 stevensc 12
  const matchHabits = useMatch('/habits/habits')
13
  const matchGoals = useMatch('/habits/goals')
14
  const matchPurposes = useMatch('/habits/purposes')
15
  const matchParadigms = useMatch('/habits/paradigms')
16
  const matchValues = useMatch('/habits/values')
3246 stevensc 17
 
3201 stevensc 18
  return (
19
    <Grid container spacing={2}>
3248 stevensc 20
      <Grid item xs={12} md={4}>
3246 stevensc 21
        <Menu>
3250 stevensc 22
          {(matchGoals || matchHabits) && (
23
            <>
24
              <Menu.Item to='/habits/habits' label='Hábitos' />
25
              <Menu.Item to='/habits/goals' label='Metas' />
26
              <Menu.Item to='/habits/purposes' label='Propósitos' />
27
            </>
28
          )}
3249 stevensc 29
          {(matchPurposes || matchParadigms || matchValues) && (
30
            <>
31
              <Menu.Item to='/habits/habits' label='Hábitos' />
32
              <Menu.Item to='/habits/purposes' label='Propósitos' />
33
              <Menu.Item to='/habits/paradigms' label='Paradigmas' />
34
              <Menu.Item to='/habits/values' label='Valores' />
35
            </>
36
          )}
3246 stevensc 37
        </Menu>
3201 stevensc 38
      </Grid>
39
 
3248 stevensc 40
      <Grid item xs={12} md={8}>
3218 stevensc 41
        <HabitsUrlsProvider>
42
          <Outlet />
43
        </HabitsUrlsProvider>
3201 stevensc 44
      </Grid>
45
    </Grid>
46
  )
47
}