mui-treasury icon indicating copy to clipboard operation
mui-treasury copied to clipboard

How to modify the background color of the InsetSidebar?

Open jlecren opened this issue 4 years ago • 3 comments

First of all, thanks for your library mui-treasury.

I would like to change the background color of an InsetSidebar but I can't figure out how to proceed.

Here is part of my code:

<InsetContainer rightSidebar={
                    <InsetSidebar
                      sidebarId={"appPageDrawer"}
                      classes={{ paper: styles.pageDrawer }}
                    >
...
                    </InsetSidebar>
                  }
                >

Style:

pageDrawer: {
    backgroundColor: "#fff",
  },

However, the background color seems to be overridden by a default style of the Paper component: Capture d’écran 2020-08-05 à 19 27 18

Then, how could I set the background color of the InsetSidebar?

jlecren avatar Aug 06 '20 07:08 jlecren

Can you provide the whole file? I guest it is the order of calling makeStyles

siriwatknp avatar Aug 06 '20 10:08 siriwatknp

The file won't work as this, as I didn't include some dependencies. Archive.zip

jlecren avatar Aug 06 '20 13:08 jlecren

My guest is true. You need to move style below component declaration like this

// move below get...(styled)
// import style from './style';

const Header = getHeader(styled);
const Content = getContent(styled);
const Fullscreen = getFullscreen(styled);
const InsetFooter = getInsetFooter(styled);
const InsetContainer = getInsetContainer(styled);
const InsetSidebar = getInsetSidebar(styled);
const DrawerSidebar = getDrawerSidebar(styled);
const SidebarContent = getSidebarContent(styled);
const CollapseBtn = getCollapseBtn(styled);

import style from './style';

Ideally, you should import style from './style'. I will create a fix version for this issue.

image

siriwatknp avatar Aug 10 '20 17:08 siriwatknp