Open aenawi opened 2 years ago
@siriwatknp Hi, I'm writing here because the issue I have may be related to this one.
EdgeSidebar seems not following theme palette mode (I have a problem when selectedTheme is lightTheme): in order to fix I need to force background & color on EdgeSidebar.
Many thanks for your help.
Mauro
In the following example selectedTheme may be lightTheme or darkTheme.
<ThemeProvider theme={selectedTheme}>
...
<Root>
<ScrollToTop />
<CssBaseline />
<Header
sx={{
...
}}
>
....
</Header>
<ThemeProvider theme={darkTheme}>
<EdgeSidebar
sx={(theme) => ({
...applyEdgeSidebarStyles({
theme,
config: {
xs: {
variant: "temporary",
width: "256px",
},
md: {
variant: "permanent",
width: "256px",
collapsible: true,
collapsedWidth: "65px",
},
},
}),
// FIX: need to force background & color in order to make it work when in light theme
background: theme.palette.background.paper,
color: theme.palette.text.primary,
})}
>
....
</EdgeSidebar>
</ThemeProvider>
<Content sx={{ py: 2 }}>
...
</Content>
</Root>
...
</ThemeProvider>
Hi
I've created a sample app using
pnpm create next-app --typescript
.I was testing the code from Right to Left page, then when I changed the scheme config for
leftEdgeSidebar
like this:The 'EdgeSidebar' component behave wrongly, it was sliding all the way from Left edge of the screen to the Right edge, where it should slide from the right side (attachment: Wrong Behavior)!
However if I do the following:
dir='rtl'
property for the<html>
tag underpages/_document.tsx
.<CacheProvider value={cacheRtl}>
and<div dir="rtl">
tags completely.anchor="right"
for<EdgeSidebar>
component.Everything seems working as expected, since all components inherits the
<html dir="rtl">
correctly. How I knew that is by inserting<ContentMockup />
component inside<Content>
where all the children flipped to RTL correctly! (attachment: Right Behavior)Any hints please?!
Thanks
Right Behavior (using
<html dir='rtl'>
insidepages/_document.tsx
):Wrong Behavior (using
stylis-plugin-rtl
):