components/elements/InfoGridWidget/index.jsjavascript
import definition from "./schema.js";
import { InfoGridWidget } from "./InfoGridWidget.jsx";
/**
* Element definition consumed by elements/registry.js (pattern:
* StoryTitle/index.js). Accepts both `textBox*` (the schema/authoring names)
* and `textbox*` casing for the same fields - content files were authored
* with the former, the component itself uses the latter - and wraps
* `textBoxText`/`grid` array entries into `{ item }` objects for the component.
*/
export default {
...definition,
component: InfoGridWidget,
adapter: ({
select,
textBoxHead,
textboxHead,
textBoxImage,
textboxImage,
textBoxText,
textboxText,
grid,
}) => ({
select: select,
textboxHead: textBoxHead || textboxHead,
textboxText: (textBoxText || textboxText || []).map((item) => ({
item: item,
})),
textboxImage: textBoxImage || textboxImage,
grid: (grid || []).map((item) => ({
item: item,
})),
}),
};