aboutsummaryrefslogtreecommitdiffstats
path: root/src/views/components/NavBarMobile.jsx
blob: 5fb11006d33d48d096f11f4fd1de8278d57dbbdf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import * as React from 'react'
import Box from '@mui/joy/Box'
import ListItemDecorator from '@mui/joy/ListItemDecorator'
import Tabs from '@mui/joy/Tabs'
import TabList from '@mui/joy/TabList'
import Tab, { tabClasses } from '@mui/joy/Tab'
import HomeRoundedIcon from '@mui/icons-material/HomeRounded'
import FavoriteBorder from '@mui/icons-material/FavoriteBorder'
import Search from '@mui/icons-material/Search'
import Person from '@mui/icons-material/Person'

export default function NavBarMobile() {
  const [index, setIndex] = React.useState(0)
  const colors = ['primary', 'danger', 'success', 'warning']
  return (
    <Box
      sx={{
        position: 'absolute',
        width: '100%',
        bottom: 0,

        flexGrow: 1,

        p: 1,
        borderTopLeftRadius: '12px',
        borderTopRightRadius: '12px',

        display: 'flex',
        justifyContent: 'center',
        alignItems: 'center',
      }}
    >
      <Tabs
        size='lg'
        aria-label='Bottom Navigation'
        value={index}
        onChange={(event, value) => setIndex(value)}
        sx={theme => ({
          p: 1,
          borderRadius: 16,
          maxWidth: 500,
          // mx: 'auto',
          boxShadow: theme.shadow.sm,
          '--joy-shadowChannel': theme.vars.palette[colors[index]].darkChannel,
          [`& .${tabClasses.root}`]: {
            py: 1,
            flex: 1,
            transition: '0.3s',
            fontWeight: 'md',
            fontSize: 'md',
            [`&:not(.${tabClasses.selected}):not(:hover)`]: {
              opacity: 0.7,
            },
          },
        })}
      >
        <TabList
          variant='plain'
          size='sm'
          disableUnderline
          sx={{ borderRadius: 'lg', p: 0 }}
        >
          <Tab
            disableIndicator
            orientation='vertical'
            {...(index === 0 && { color: colors[0] })}
          >
            <ListItemDecorator>
              <HomeRoundedIcon />
            </ListItemDecorator>
            Home
          </Tab>
          <Tab
            disableIndicator
            orientation='vertical'
            {...(index === 1 && { color: colors[1] })}
          >
            <ListItemDecorator>
              <FavoriteBorder />
            </ListItemDecorator>
            Likes
          </Tab>
          <Tab
            disableIndicator
            orientation='vertical'
            {...(index === 2 && { color: colors[2] })}
          >
            <ListItemDecorator>
              <Search />
            </ListItemDecorator>
            Search
          </Tab>
          <Tab
            disableIndicator
            orientation='vertical'
            {...(index === 3 && { color: colors[3] })}
          >
            <ListItemDecorator>
              <Person />
            </ListItemDecorator>
            Profile
          </Tab>
        </TabList>
      </Tabs>
    </Box>
  )
}