棱柱形模板形式

template forms in prismic

我是 prismic 的新手,正在尝试弄清楚这是否是满足我需要的正确工具。我需要创建多个表单模板。我希望 prismic 用户能够构建模板,该模板将被加载到 gatsby 中,每个字段将基于标题、类型、操作、名称构建为组件。

prismic 似乎是一个很好的候选者吗?有谁知道我可以如何设置棱镜末端的任何示例。到目前为止,我看到的大部分内容都是完整的页面,只有标题和图片。不完全是形式。

在他们的存储库中,我只看到这些用于创建元素的选项,我是否遗漏了一些重要的选项?

我将如何创建表单元素,有没有办法创建自定义 object 以导出?每次我尝试向 json 编辑器添加新文件或自定义 object 时,它都会说。无法识别,属性 会被忽略。 我希望能够使用该组将一堆表单元素组合在一起,即使它们只是我可以传递自定义属性的自定义 objects,所以当我将组加载到 React 中时,我可以使用自定义属性来构建我的组件??如果可以使用 prismic,谁能直接告诉我。

谢谢!

我不能说 Prismic 是否是这项特定工作的最佳工具,但我认为您高估了渲染 html 表单所需的确切工具。

考虑以下自定义类型。它实际上只包含标题、结构化文本、可重复区域和 select。您如何处理这些数据完全取决于您在前端。

{
  "Main": {
    "uid": {
      "type": "UID",
      "config": {
        "label": "Form UID",
        "placeholder": "Form UID"
      }
    },
    "form_title": {
      "type": "StructuredText",
      "config": {
        "single": "heading2",
        "label": "Form Title",
        "placeholder": "Form Title"
      }
    },
    "action_title": {
      "type": "StructuredText",
      "config": {
        "single": "heading2",
        "label": "action title",
        "placeholder": "Submit form"
      }
    },
    "form_action_description": {
      "type": "StructuredText",
      "config": {
        "single": "paragraph",
        "label": "form action description",
        "placeholder": "form action description"
      }
    },
    "success_message": {
      "type": "StructuredText",
      "config": {
        "single": "paragraph",
        "label": "success message",
        "placeholder": "success message"
      }
    },
    "error_message": {
      "type": "StructuredText",
      "config": {
        "single": "paragraph",
        "label": "error message",
        "placeholder": "error message"
      }
    },
    "submit_button_text": {
      "type": "StructuredText",
      "config": {
        "single": "paragraph",
        "label": "submit button text",
        "placeholder": "submit"
      }
    },
    "body": {
      "type": "Slices",
      "fieldset": "Slice zone",
      "config": {
        "choices": {
          "test": {
            "type": "Slice",
            "fieldset": "Form Section",
            "description": "Section of a form",
            "icon": "vertical_align_center",
            "display": "list",
            "non-repeat": {
              "form_section_title": {
                "type": "StructuredText",
                "config": {
                  "single": "heading1",
                  "label": "Form Section title",
                  "placeholder": "Form Section title"
                }
              },
              "form_section_description": {
                "type": "StructuredText",
                "config": {
                  "single": "paragraph",
                  "label": "Form Section Description",
                  "placeholder": "Form Section Description"
                }
              }
            },
            "repeat": {
              "label": {
                "type": "StructuredText",
                "config": {
                  "single": "paragraph",
                  "label": "label",
                  "placeholder": "label"
                }
              },
              "type": {
                "type": "Select",
                "config": {
                  "options": [
                    "text",
                    "textarea",
                    "checkbox",
                    "radio",
                    "submit"
                  ],
                  "default_value": "text",
                  "label": "type"
                }
              },
              "name": {
                "type": "StructuredText",
                "config": {
                  "single": "paragraph",
                  "label": "name",
                  "placeholder": "name"
                }
              }
            }
          }
        }
      }
    }
  }
}