Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Shadow is visible when sidebar is closed #115

Open
timbset opened this issue May 31, 2017 · 2 comments
Open

Shadow is visible when sidebar is closed #115

timbset opened this issue May 31, 2017 · 2 comments

Comments

@timbset
Copy link

timbset commented May 31, 2017

Sidebar is moved to the border of view on close, no more. That's why the box shadow is visible. Isn't it better to move it some pixels more to hide it?

@andreyluiz
Copy link

andreyluiz commented Dec 7, 2017

I tried to conditionally deactivate the shadow:

<Sidebar
  sidebar={<MenuContent onMenuItemSelected={this.menuItemSelected} />}
  open={open}
  docked={docked}
  onSetOpen={onSetSidebarOpen}
  styles={{
    overlay: {
      zIndex: !docked && open ? 3001 : 2000,
    },
    sidebar: {
      width: 256,
      zIndex: 4000,
      boxShadow: (docked || !open) ? 'none' : 'rgba(0, 0, 0, 0.15) 2px 2px 4px;',
    },
    content: {
      top: 64,
    },
  }}
>
  {children}
</Sidebar>

But the shadow is not overrided.

Looking at the code, it is totally non-sense regarding the shadow prop:

if (this.props.pullRight) {
  // ...
} else {
  // ...
  if (this.props.shadow) {
    sidebarStyle.boxShadow = '2px 2px 4px rgba(0, 0, 0, 0.15)';
  }
}

I created a PR #136 to fix this weird code. While it is not done I am using the commit from my fork and it works great.

@aelor
Copy link

aelor commented Apr 4, 2018

The overwrite with styles doesn't seem to work but if you add a custom class to the sidebar using sidebarClassName, it works.

Here is how the prop is added

<Sidebar
        sidebar={sidebarContent}
        open={this.state.sidebarOpen}
        onSetOpen={this.onSetSidebarOpen}
        sidebarClassName="customSidebar"
      >
  <b>My content</b>
</Sidebar>

and the css

.customSidebar {
    left: -5px !important;
}

@markusenglund markusenglund mentioned this issue Jul 30, 2018
4 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants