Add view and setView props in order to successfully pass state from Sidebar to the Canvas inside Dashboard
This commit is contained in:
@@ -2,12 +2,16 @@ import { Global, css } from "@emotion/react";
|
||||
import Header from './Header/Header.jsx';
|
||||
import Sidebar from './Sidebar/Sidebar.jsx';
|
||||
import Canvas from './Canvas/Canvas.jsx';
|
||||
import { Grid, GridItem, useRecipe, Box } from '@chakra-ui/react';
|
||||
import { Grid, GridItem, useRecipe } from '@chakra-ui/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function Dashboard() {
|
||||
const recipe = useRecipe({ key: "canvas" });
|
||||
const styles = recipe();
|
||||
|
||||
// Lifted State - defaults to widget dashboard
|
||||
const [view, setView] = useState("widget");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Global // change the background color of widget shadow when moving
|
||||
@@ -37,10 +41,10 @@ export default function Dashboard() {
|
||||
<Header />
|
||||
</GridItem>
|
||||
<GridItem colSpan={1}>
|
||||
<Sidebar />
|
||||
<Sidebar onChangeView={ setView } />
|
||||
</GridItem>
|
||||
<GridItem colSpan={1} width="100%">
|
||||
<Canvas />
|
||||
<Canvas view={ view }/>
|
||||
</GridItem>
|
||||
</Grid>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user