payload-advanced-sidebar 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +42 -49
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,16 +1,15 @@
1
- # Payload Plugin Advanced Sidebar
1
+ # Payload Advanced Sidebar
2
2
 
3
- A Payload CMS 3.0 plugin that gives you complete control over your admin sidebar navigation. Organize collections and globals into custom groups, add custom icons, and hide specific items with ease.
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
  ![Sidebar Preview](./images/sidebar-preview.png)
6
6
 
7
7
  ## Features
8
8
 
9
- - 📁 **Custom Groups**: Organize your collections and globals into logical groups.
10
- - 🎨 **Custom Icons**: Add Lucide React icons or your own custom icons to your navigation items.
11
- - 👻 **Hide Items**: Easily hide specific collections or globals from the sidebar.
12
- - 🔗 **External Links**: Add custom external links to your sidebar (if applicable).
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
- Add the plugin to your Payload configuration:
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
- // ... rest of your config
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
- navItems: [
39
- {
40
- type: 'group',
41
- label: 'Content Management',
42
- icon: Settings, // Optional group icon
43
- items: [
44
- {
45
- type: 'collection',
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
- type: 'group',
58
- label: 'Administration',
59
- items: [
60
- {
61
- type: 'collection',
62
- slug: 'users',
63
- icon: Users,
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
- ![Configuration Example](https://via.placeholder.com/800x400.png?text=Add+Configuration+Screenshot+Here)
79
-
80
73
  ## Plugin Options
81
74
 
82
- | Option | Type | Description |
83
- | -------------- | ------------------------------------------------ | --------------------------------------------------------------------------- |
84
- | `navItems` | `NavItem[]` | Array of custom navigation groups and items to render in the sidebar. |
85
- | `hideSettings` | `{ collections?: string[], globals?: string[] }` | Optional settings to hide specific collections or globals from the sidebar. |
86
- | `disabled` | `boolean` | Set to `true` to disable the plugin entirely. |
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.0",
3
+ "version": "1.0.1",
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",