MCPcopy
hub / github.com/devias-io/material-kit-react / NavItem

Function NavItem

src/components/dashboard/layout/mobile-nav.tsx:144–199  ·  view source on GitHub ↗
({ disabled, external, href, icon, matcher, pathname, title }: NavItemProps)

Source from the content-addressed store, hash-verified

142}
143
144function NavItem({ disabled, external, href, icon, matcher, pathname, title }: NavItemProps): React.JSX.Element {
145 const active = isNavItemActive({ disabled, external, href, matcher, pathname });
146 const Icon = icon ? navIcons[icon] : null;
147
148 return (
149 <li>
150 <Box
151 {...(href
152 ? {
153 component: external ? 'a' : RouterLink,
154 href,
155 target: external ? '_blank' : undefined,
156 rel: external ? 'noreferrer' : undefined,
157 }
158 : { role: 'button' })}
159 sx={{
160 alignItems: 'center',
161 borderRadius: 1,
162 color: 'var(--NavItem-color)',
163 cursor: 'pointer',
164 display: 'flex',
165 flex: '0 0 auto',
166 gap: 1,
167 p: '6px 16px',
168 position: 'relative',
169 textDecoration: 'none',
170 whiteSpace: 'nowrap',
171 ...(disabled && {
172 bgcolor: 'var(--NavItem-disabled-background)',
173 color: 'var(--NavItem-disabled-color)',
174 cursor: 'not-allowed',
175 }),
176 ...(active && { bgcolor: 'var(--NavItem-active-background)', color: 'var(--NavItem-active-color)' }),
177 }}
178 >
179 <Box sx={{ alignItems: 'center', display: 'flex', justifyContent: 'center', flex: '0 0 auto' }}>
180 {Icon ? (
181 <Icon
182 fill={active ? 'var(--NavItem-icon-active-color)' : 'var(--NavItem-icon-color)'}
183 fontSize="var(--icon-fontSize-md)"
184 weight={active ? 'fill' : undefined}
185 />
186 ) : null}
187 </Box>
188 <Box sx={{ flex: '1 1 auto' }}>
189 <Typography
190 component="span"
191 sx={{ color: 'inherit', fontSize: '0.875rem', fontWeight: 500, lineHeight: '28px' }}
192 >
193 {title}
194 </Typography>
195 </Box>
196 </Box>
197 </li>
198 );
199}

Callers

nothing calls this directly

Calls 1

isNavItemActiveFunction · 0.90

Tested by

no test coverage detected