payload-advanced-sidebar 1.0.0 → 1.0.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/README.md +42 -49
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
# Payload
|
|
1
|
+
# Payload Advanced Sidebar
|
|
2
2
|
|
|
3
|
-
A Payload CMS 3.0 plugin that
|
|
3
|
+
A Payload CMS 3.0 plugin that enhances your admin sidebar navigation. It allows you to assign custom icons to your collection/global groups as well as individual items, making your admin interface much more visually appealing and organized.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- 📁 **
|
|
10
|
-
- 🎨 **
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- ⚙️ **Simple Configuration**: Easy to set up and configure directly from your Payload config.
|
|
9
|
+
- 📁 **Group Icons**: Assign custom icons to the sidebar groups you've defined in your Payload config.
|
|
10
|
+
- 🎨 **Item Icons**: Assign custom icons to individual collections and globals.
|
|
11
|
+
- ⚡️ **Lucide React Integration**: Uses [Lucide React](https://lucide.dev/) icons by default. Just pass the exact string name of the icon (e.g., `'ShoppingCart'`).
|
|
12
|
+
- ⚙️ **Simple Configuration**: Seamlessly integrates with your existing Payload config without needing to rewrite your navigation structure.
|
|
14
13
|
|
|
15
14
|
## Installation
|
|
16
15
|
|
|
@@ -24,66 +23,60 @@ pnpm add payload-advanced-sidebar
|
|
|
24
23
|
|
|
25
24
|
## Usage
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
This plugin relies on the standard `admin.group` property you define on your collections and globals in Payload. You simply map those group names or item slugs to an icon!
|
|
27
|
+
|
|
28
|
+
Add the plugin to your `payload.config.ts`:
|
|
28
29
|
|
|
29
30
|
```typescript
|
|
30
31
|
import { buildConfig } from 'payload/config'
|
|
31
32
|
import { advancedSidebarPlugin } from 'payload-advanced-sidebar'
|
|
32
|
-
import { Settings, Users } from 'lucide-react'
|
|
33
33
|
|
|
34
34
|
export default buildConfig({
|
|
35
|
-
|
|
35
|
+
collections: [
|
|
36
|
+
{
|
|
37
|
+
slug: 'posts',
|
|
38
|
+
admin: { group: 'Content' }, // The group name used below
|
|
39
|
+
fields: [],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
slug: 'customers',
|
|
43
|
+
admin: { group: 'E-commerce' }, // The group name used below
|
|
44
|
+
fields: [],
|
|
45
|
+
}
|
|
46
|
+
],
|
|
36
47
|
plugins: [
|
|
37
48
|
advancedSidebarPlugin({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
icon:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
slug: 'posts',
|
|
47
|
-
icon: Settings, // Optional item icon
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: 'collection',
|
|
51
|
-
slug: 'pages',
|
|
52
|
-
icon: Settings,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
49
|
+
enabled: true, // Optional: defaults to true
|
|
50
|
+
// 1. Configure icons for your navigation groups
|
|
51
|
+
groups: {
|
|
52
|
+
'E-commerce': {
|
|
53
|
+
icon: 'ShoppingCart', // String matching a Lucide React icon
|
|
54
|
+
},
|
|
55
|
+
'Content': {
|
|
56
|
+
icon: 'LayoutDashboard',
|
|
55
57
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
],
|
|
58
|
+
},
|
|
59
|
+
// 2. Configure icons for specific items (by slug)
|
|
60
|
+
items: {
|
|
61
|
+
'posts': {
|
|
62
|
+
icon: 'Book',
|
|
63
|
+
},
|
|
64
|
+
'customers': {
|
|
65
|
+
icon: 'Users',
|
|
66
66
|
},
|
|
67
|
-
],
|
|
68
|
-
// Optional: Globally hide specific collections/globals
|
|
69
|
-
hideSettings: {
|
|
70
|
-
collections: ['hidden-collection'],
|
|
71
|
-
globals: ['hidden-global'],
|
|
72
67
|
},
|
|
73
68
|
}),
|
|
74
69
|
],
|
|
75
70
|
})
|
|
76
71
|
```
|
|
77
72
|
|
|
78
|
-

|
|
79
|
-
|
|
80
73
|
## Plugin Options
|
|
81
74
|
|
|
82
|
-
| Option
|
|
83
|
-
|
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
75
|
+
| Option | Type | Default | Description |
|
|
76
|
+
| :--- | :--- | :--- | :--- |
|
|
77
|
+
| `enabled` | `boolean` | `true` | Set to `false` to easily disable the plugin entirely. |
|
|
78
|
+
| `groups` | `Record<string, { icon?: string }>` | `{}` | Map your group names (e.g., `'E-commerce'`) to specific Lucide React icon names. |
|
|
79
|
+
| `items` | `Record<string, { icon?: string }>` | `{}` | Map your collection/global slugs (e.g., `'posts'`) to specific Lucide React icon names. |
|
|
87
80
|
|
|
88
81
|
## Development
|
|
89
82
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-advanced-sidebar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A Payload CMS 3.0 plugin to customize the admin sidebar with grouping, custom icons, and hide functionality.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"customization",
|
|
12
12
|
"admin"
|
|
13
13
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"homepage": "https://github.com/Mhmod-Hsn/payload-advanced-sidebar#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Mhmod-Hsn/payload-advanced-sidebar/issues"
|
|
17
|
+
},
|
|
16
18
|
"repository": {
|
|
17
19
|
"type": "git",
|
|
18
20
|
"url": "https://github.com/Mhmod-Hsn/payload-advanced-sidebar.git"
|
|
19
21
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
"homepage": "https://github.com/Mhmod-Hsn/payload-advanced-sidebar#readme",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Mahmoud Hassan",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
@@ -62,6 +62,9 @@
|
|
|
62
62
|
"test:e2e": "playwright test",
|
|
63
63
|
"test:int": "vitest"
|
|
64
64
|
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"lucide-react": "^1.17.0"
|
|
67
|
+
},
|
|
65
68
|
"devDependencies": {
|
|
66
69
|
"@eslint/eslintrc": "^3.2.0",
|
|
67
70
|
"@payloadcms/db-mongodb": "3.84.1",
|
|
@@ -83,7 +86,6 @@
|
|
|
83
86
|
"eslint": "^9.23.0",
|
|
84
87
|
"eslint-config-next": "16.2.6",
|
|
85
88
|
"graphql": "^16.8.1",
|
|
86
|
-
"lucide-react": "^1.17.0",
|
|
87
89
|
"mongodb-memory-server": "10.1.4",
|
|
88
90
|
"next": "16.2.6",
|
|
89
91
|
"open": "^10.1.0",
|
|
@@ -93,7 +95,6 @@
|
|
|
93
95
|
"react": "19.2.6",
|
|
94
96
|
"react-dom": "19.2.6",
|
|
95
97
|
"rimraf": "3.0.2",
|
|
96
|
-
"sass": "^1.100.0",
|
|
97
98
|
"sharp": "0.34.2",
|
|
98
99
|
"sort-package-json": "^2.10.0",
|
|
99
100
|
"typescript": "5.7.3",
|