Projekt

Obecné

Profil

« Předchozí | Další » 

Revize e9103a47

Přidáno uživatelem Václav Honzík před asi 2 roky(ů)

Persist navigation state

re #9630

Zobrazit rozdíly:

frontend/src/features/Navigation/Navigation.tsx
17 17

  
18 18
import DarkModeIcon from '@mui/icons-material/DarkMode'
19 19
import LightModeIcon from '@mui/icons-material/LightMode'
20
import { setOpen } from './navigationSlice'
20 21

  
21 22
const drawerWidth = 240
22 23

  
......
74 75
}
75 76

  
76 77
const PersistentDrawerLeft: FunctionComponent<DrawerProps> = ({ children }) => {
77
    const [open, setOpen] = React.useState(false)
78
    const open = useSelector((state: RootState) => state.navigation.open)
78 79

  
79 80
    const onOpenDrawer = () => {
80
        setOpen(true)
81
        dispatch(setOpen(true))
81 82
    }
82 83

  
83 84
    const colorThemeMode = useSelector(
......
92 93

  
93 94
    return (
94 95
        <Fragment>
95
            <Paper style={{ minHeight: '100vh', borderRadius: 0 }}>
96
            <Paper style={{ minHeight: '100vh', borderRadius: 0}}>
96 97
                <Box sx={{ display: 'flex' }}>
97 98
                    {/* <CssBaseline /> */}
98 99
                    <AppBar position="fixed" open={open}>
......
125 126
                    <NavigationMenu
126 127
                        open={open}
127 128
                        drawerWidth={drawerWidth}
128
                        setOpen={setOpen}
129
                        setOpen={(open: boolean) => dispatch(setOpen(open))}
129 130
                    />
130 131
                    <Main open={open} sx={{ mt: 2 }}>
131 132
                        <DrawerHeader />

Také k dispozici: Unified diff