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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "9.5.0",
3
+ "version": "9.5.2",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -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 onClick={() => setGroupOpen(!groupOpen)}>
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
@@ -37,4 +37,4 @@ export async function initAdmin(prefix = "", containerId: string = "root") {
37
37
  )
38
38
  }
39
39
 
40
- export const VERSION = "9.5.0"
40
+ export const VERSION = "9.5.2"
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
  },