File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
- import React , { CSSProperties } from 'react'
1
+ import React , { ComponentType , CSSProperties } from 'react'
2
2
import { Dashboard } from './containers/Dashboard'
3
3
import { definePlugin } from 'sanity'
4
4
import { DashboardConfig , DashboardWidget , LayoutConfig } from './types'
@@ -25,7 +25,18 @@ const DashboardIcon = () => (
25
25
)
26
26
27
27
export interface DashboardPluginConfig {
28
+ /**
29
+ * Dashboard tool title
30
+ */
28
31
title ?: string
32
+ /**
33
+ * Dashboard tool name (used in url path)
34
+ */
35
+ name ?: string
36
+ /**
37
+ * Dashboard tool icon
38
+ */
39
+ icon ?: ComponentType
29
40
widgets ?: DashboardWidget [ ]
30
41
31
42
/**
@@ -39,8 +50,10 @@ export const dashboardTool = definePlugin<DashboardPluginConfig>((config = {}) =
39
50
layout : config . defaultLayout ?? { } ,
40
51
widgets : config . widgets ?? [ ] ,
41
52
}
42
-
53
+
43
54
const title = config . title ?? 'Dashboard'
55
+ const name = config . name ?? 'dashboard'
56
+ const icon = config . icon ?? DashboardIcon
44
57
45
58
return {
46
59
name : 'dashboard' ,
@@ -49,8 +62,8 @@ export const dashboardTool = definePlugin<DashboardPluginConfig>((config = {}) =
49
62
...prev ,
50
63
{
51
64
title,
52
- name : 'dashboard' ,
53
- icon : DashboardIcon ,
65
+ name,
66
+ icon,
54
67
component : ( ) => < Dashboard config = { pluginConfig } /> ,
55
68
} ,
56
69
]
You can’t perform that action at this time.
0 commit comments