Added more agent skills
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { ArrayField, Field, GroupField } from 'payload'
|
||||
|
||||
import { rowLabel } from 'src/modules/admin-ui/rowLabel.js'
|
||||
|
||||
export type LinkAppearance = 'link' | 'primary' | 'secondary'
|
||||
|
||||
export type BuildLinkFieldOptions = {
|
||||
@@ -116,6 +118,11 @@ export function buildLinkField({
|
||||
}
|
||||
|
||||
export type BuildLinksFieldOptions = {
|
||||
/**
|
||||
* What one row is called in the panel — the add button reads "Add <singular>".
|
||||
* Default { singular: 'Button', plural: 'Buttons' }; e.g. { singular: 'Link', plural: 'Links' } for a link list.
|
||||
*/
|
||||
labels?: { plural: string; singular: string }
|
||||
/** Max number of buttons. Default 2. */
|
||||
maxRows?: number
|
||||
/** Field name. Default 'links'. */
|
||||
@@ -128,14 +135,21 @@ export type BuildLinksFieldOptions = {
|
||||
*/
|
||||
export function buildLinksField({
|
||||
name = 'links',
|
||||
labels = { plural: 'Buttons', singular: 'Button' },
|
||||
maxRows = 2,
|
||||
...linkOptions
|
||||
}: BuildLinksFieldOptions = {}): ArrayField {
|
||||
return {
|
||||
name,
|
||||
type: 'array',
|
||||
admin: { initCollapsed: true },
|
||||
admin: {
|
||||
initCollapsed: true,
|
||||
// Rows read "Contact us" / "Download catalogue", not "Button 01". Needs the importMap entry.
|
||||
components: rowLabel(['link.label', 'link.url'], labels.singular),
|
||||
},
|
||||
fields: [buildLinkField(linkOptions)],
|
||||
label: labels.plural,
|
||||
labels,
|
||||
maxRows,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user