chore: retirer le state et l'UI morts de navigasyon.js
This commit is contained in:
@@ -1,15 +1,11 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import {useState} from 'react'
|
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import {useRouter, usePathname} from 'next/navigation'
|
import {useRouter, usePathname} from 'next/navigation'
|
||||||
|
|
||||||
import {styled} from '@mui/material/styles'
|
import {styled} from '@mui/material/styles'
|
||||||
import AppBar from '@mui/material/AppBar'
|
import AppBar from '@mui/material/AppBar'
|
||||||
import Tabs, {tabsClasses} from '@mui/material/Tabs'
|
import Tabs, {tabsClasses} from '@mui/material/Tabs'
|
||||||
import Tab from '@mui/material/Tab'
|
import Tab from '@mui/material/Tab'
|
||||||
import Typography from '@mui/material/Typography'
|
|
||||||
import Box from '@mui/material/Box'
|
|
||||||
import {useMediaQuery} from '@mui/material'
|
import {useMediaQuery} from '@mui/material'
|
||||||
|
|
||||||
import MusicNoteIcon from '@mui/icons-material/MusicNote'
|
import MusicNoteIcon from '@mui/icons-material/MusicNote'
|
||||||
@@ -49,32 +45,6 @@ const tabPath = {
|
|||||||
awtis: 3,
|
awtis: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const {children, value, index, ...other} = props
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role='tabpanel'
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`scrollable-force-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`scrollable-force-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
>
|
|
||||||
{value === index && (
|
|
||||||
<Box p={3}>
|
|
||||||
<Typography component='div'>{children}</Typography>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.any.isRequired,
|
|
||||||
value: PropTypes.any.isRequired
|
|
||||||
}
|
|
||||||
|
|
||||||
function a11yProps(index) {
|
function a11yProps(index) {
|
||||||
return {
|
return {
|
||||||
id: `scrollable-force-tab-${index}`,
|
id: `scrollable-force-tab-${index}`,
|
||||||
@@ -89,11 +59,8 @@ export default function Navigasyon() {
|
|||||||
const selectedTab = tabPath[selectedPath]
|
const selectedTab = tabPath[selectedPath]
|
||||||
|
|
||||||
const isMobile = useMediaQuery('(max-width:422px)')
|
const isMobile = useMediaQuery('(max-width:422px)')
|
||||||
const [value, setValue] = useState(0)
|
|
||||||
|
|
||||||
const handleChange = (event, newValue) => {
|
const handleChange = (event, newValue) => {
|
||||||
setValue(newValue)
|
|
||||||
|
|
||||||
if (newValue !== selectedTab) {
|
if (newValue !== selectedTab) {
|
||||||
router.push(tabRouteHref[newValue])
|
router.push(tabRouteHref[newValue])
|
||||||
}
|
}
|
||||||
@@ -126,10 +93,6 @@ export default function Navigasyon() {
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
}
|
}
|
||||||
</AppBar>
|
</AppBar>
|
||||||
<TabPanel value={value} index={0} />
|
|
||||||
<TabPanel value={value} index={1} />
|
|
||||||
<TabPanel value={value} index={2} />
|
|
||||||
<TabPanel value={value} index={3} />
|
|
||||||
</div>
|
</div>
|
||||||
</Appdiv>
|
</Appdiv>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user