index.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { defineDashboardExtension } from '@vendure/dashboard';
  2. import {
  3. ColorPickerComponent,
  4. EmailInputComponent,
  5. MarkdownEditorComponent,
  6. MultiCurrencyInputComponent,
  7. SlugInputComponent,
  8. TagsInputComponent,
  9. } from './form-components';
  10. defineDashboardExtension({
  11. customFormComponents: {
  12. customFields: [
  13. {
  14. id: 'test-input',
  15. component: props => {
  16. return (
  17. <input
  18. placeholder="custom input"
  19. value={props.value || ''}
  20. onChange={e => props.onChange(e.target.value)}
  21. className="border rounded-full"
  22. />
  23. );
  24. },
  25. },
  26. {
  27. id: 'color-picker',
  28. component: ColorPickerComponent,
  29. },
  30. {
  31. id: 'custom-email',
  32. component: EmailInputComponent,
  33. },
  34. {
  35. id: 'multi-currency-input',
  36. component: MultiCurrencyInputComponent,
  37. },
  38. {
  39. id: 'tags-input',
  40. component: TagsInputComponent,
  41. },
  42. ],
  43. },
  44. detailForms: [
  45. {
  46. pageId: 'product-detail',
  47. inputs: [
  48. {
  49. blockId: 'main-form',
  50. field: 'slug',
  51. component: SlugInputComponent,
  52. },
  53. {
  54. blockId: 'main-form',
  55. field: 'description',
  56. component: MarkdownEditorComponent,
  57. },
  58. ],
  59. },
  60. {
  61. pageId: 'customer-detail',
  62. inputs: [
  63. {
  64. blockId: 'main-form',
  65. field: 'emailAddress',
  66. component: EmailInputComponent,
  67. },
  68. ],
  69. },
  70. ],
  71. });