function createForm()

in src/components/create/Create.tsx [94:178]


  function createForm() {
    return (
      <Box margin={{ bottom: "l" }} padding="l">
        <CustomBreadCrumb items={[{ text: "Create", href: "/create" }]} />
        <Container
          header={
            <Header
              className="leftPadded"
              variant="h2"
              description=""
              actions={
                <SpaceBetween direction="horizontal" size="xl">
                  <Select
                    className="sampleDataSelectionDropdown"
                    selectedOption={selectedSampleDataOption}
                    onChange={({ detail }) => {
                      setSelectedSampleDataOption(detail.selectedOption);
                      const stringCast = String(detail.selectedOption.value);
                      setCreateJSON(stringCast);
                    }}
                    options={[
                      { label: "-", value: "{}" },
                      {
                        label: "Sample Patient Resource Data",
                        value: JSON.stringify(samplePatientResource, null, 2),
                      },
                      {
                        label: "Sample Practitioner Resource Data",
                        value: JSON.stringify(
                          samplePractitionerResource,
                          null,
                          2
                        ),
                      },
                      {
                        label: "Sample Observation Resource Data",
                        value: JSON.stringify(sampleObservationResource, null, 2),
                      },
                      {
                        label: "Sample Schedule Resource Data",
                        value: JSON.stringify(sampleScheduleResource, null, 2),
                      },
                    ]}
                    placeholder="Load Sample Data"
                    selectedAriaLabel="Selected"
                  />
                  <Button
                    variant="primary"
                    disabled={!isJsonValid}
                    loading={isCreatingResource}
                    onClick={async () => {
                      const result = await createResource(
                        JSON.parse(createJSON)
                      );
                      setApiResponse(result);
                    }}
                  >
                    Create
                  </Button>
                </SpaceBetween>
              }
            >
              Create New FHIR Resource
            </Header>
          }
        >
          <CodeEditor
            ace={ace}
            language="json"
            value={createJSON}
            preferences={preferences}
            onPreferencesChange={(e) => setPreferences(e.detail)}
            onChange={(e) => setCreateJSON(e.detail.value)}
            loading={loading}
            i18nStrings={i18nStrings}
            onValidate={(e) => {
              e.detail.annotations.length === 0
                ? setIsJsonValid(true)
                : setIsJsonValid(false);
            }}
          />
        </Container>
      </Box>
    );
  }