muffin-admin 9.5.0 → 9.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MuffinMenu.js +15 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/themes.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinMenu.tsx +19 -9
- package/src/index.tsx +1 -1
- package/src/themes.ts +2 -2
package/package.json
CHANGED
package/src/MuffinMenu.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import ListItemIcon from "@mui/material/ListItemIcon"
|
|
|
6
6
|
import ListItemText from "@mui/material/ListItemText"
|
|
7
7
|
import { matchPath, useLocation } from "react-router-dom"
|
|
8
8
|
|
|
9
|
-
import { Menu, MenuProps, useBasename, useTranslate } from "react-admin"
|
|
9
|
+
import { Menu, MenuProps, useBasename, useTheme, useTranslate } from "react-admin"
|
|
10
10
|
|
|
11
11
|
import find from "lodash/find"
|
|
12
12
|
import groupBy from "lodash/groupBy"
|
|
@@ -47,19 +47,29 @@ function MenuGroup({ name, resources }: { name: string; resources: AdminResource
|
|
|
47
47
|
const basename = useBasename()
|
|
48
48
|
const { pathname } = useLocation()
|
|
49
49
|
const match = resources.some(
|
|
50
|
-
(resource) =>
|
|
51
|
-
!!matchPath(
|
|
52
|
-
{
|
|
53
|
-
path: `${basename}/${resource.name}/*`,
|
|
54
|
-
},
|
|
55
|
-
pathname
|
|
56
|
-
)
|
|
50
|
+
(resource) => !!matchPath({ path: `${basename}/${resource.name}/*` }, pathname)
|
|
57
51
|
)
|
|
58
52
|
const [groupOpen, setGroupOpen] = useState(match)
|
|
53
|
+
const theme = useTheme()[0]
|
|
54
|
+
const colors =
|
|
55
|
+
theme == "dark"
|
|
56
|
+
? {
|
|
57
|
+
text: "rgba(255, 255, 255, 0.87)",
|
|
58
|
+
textSecondary: "rgba(255, 255, 255, 0.6)",
|
|
59
|
+
}
|
|
60
|
+
: {
|
|
61
|
+
text: "rgba(0, 0, 0, 0.87)",
|
|
62
|
+
textSecondary: "rgba(0, 0, 0, 0.6)",
|
|
63
|
+
}
|
|
59
64
|
|
|
60
65
|
return (
|
|
61
66
|
<div>
|
|
62
|
-
<ListItemButton
|
|
67
|
+
<ListItemButton
|
|
68
|
+
onClick={() => setGroupOpen(!groupOpen)}
|
|
69
|
+
sx={{
|
|
70
|
+
color: match ? colors.text : colors.textSecondary,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
63
73
|
{Icon && (
|
|
64
74
|
<ListItemIcon sx={{ minWidth: 40 }}>
|
|
65
75
|
<Icon />
|
package/src/index.tsx
CHANGED
package/src/themes.ts
CHANGED
|
@@ -8,8 +8,8 @@ export const muffinLightTheme: typeof defaultLightTheme = {
|
|
|
8
8
|
styleOverrides: {
|
|
9
9
|
root: {
|
|
10
10
|
"&.RaMenuItemLink-active": {
|
|
11
|
-
backgroundColor: "#f0f0f0",
|
|
12
11
|
borderRadius: "4px",
|
|
12
|
+
backgroundColor: "#f0f0f0",
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
@@ -25,8 +25,8 @@ export const muffinDarkTheme: typeof defaultDarkTheme = {
|
|
|
25
25
|
styleOverrides: {
|
|
26
26
|
root: {
|
|
27
27
|
"&.RaMenuItemLink-active": {
|
|
28
|
-
backgroundColor: "#424242",
|
|
29
28
|
borderRadius: "4px",
|
|
29
|
+
backgroundColor: "#424242",
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
},
|