NouanceLabs / payload-better-fields-plugin

This plugin aims to provide you with very specific and improved fields for the Payload admin panel.
MIT License
124 stars 2 forks source link

Documentation: Alert Box field example code not working #68

Closed guspatagonico closed 4 months ago

guspatagonico commented 5 months ago

Hi! I found the example code for AlertBoxField to be wrong. Reference url: https://github.com/NouanceLabs/payload-better-fields-plugin?search=1#usage-7

import { CollectionConfig } from 'payload/types'
import { AlertBoxField } from '@nouance/payload-better-fields-plugin'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...AlertBoxField({
      name: 'alert',
      {
        type: 'info',
        message: 'Please be aware that the title is required for the mobile app.',
      }
    }),
  ],
}

export default Examples

My proposed correction is this:

import { CollectionConfig } from 'payload/types'
import { AlertBoxField } from '@nouance/payload-better-fields-plugin'

const Examples: CollectionConfig = {
  slug: 'examples',
  admin: {
    useAsTitle: 'title',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
    },
    ...AlertBoxField(
    {
      name: 'alert' 
    },
    {
        type: 'info',
        message: 'Please be aware that the title is required for the mobile app.',
      }
    ),
  ],
}

export default Examples

Best regards. Gustavo

paulpopus commented 4 months ago

Thanks for bringing this up, will be fixed in the next release!