Skip to content

Commit

Permalink
Add links to exposed demo wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed May 22, 2024
1 parent b57aefd commit b0cfd87
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ interface BuildFormButtonTesterWrapperForStorybookProps {
questionnaireResponse?: QuestionnaireResponse;
}

/**
* This is a demo wrapper which initialises the BaseRenderer with the passed in questionnaire using useBuildForm.
* It also provides a button to build the form with the passed in questionnaire + questionnaireResponse.
* It was done as a two-step process for demo purposes.
*
* Use this pattern if you already have a pre-populated/pre-filled/draft response.
* If you want to pre-pop on the fly, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopWrapperForStorybook.tsx instead
*
* @author Sean Fong
*/
function BuildFormButtonTesterWrapperForStorybook(
props: BuildFormButtonTesterWrapperForStorybookProps
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ interface InitialiseFormWrapperProps {
* - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
*
* For button click usage examples of buildForm(), see:
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonTesterWrapper.tsx#L47
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/BuildFormButtonForStorybook.tsx
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopWrapperForStorybook.tsx
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopButtonForStorybook.tsx
*
* @author Sean Fong
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ interface PrePopWrapperForStorybookProps {
user: Practitioner;
}

/**
* This is a demo wrapper which initialises the BaseRenderer with the passed in questionnaire using useBuildForm.
* It also provides a button to pre-populate the questionnaire on the fly using populateQuestionnaire() from '@aehrc/sdc-populate'.
* This does in-app population and you have to define your own callback function to retrieve resources from your source server.
*
* Use this pattern if you do not have a pre-populated/pre-filled/draft response and want to pre-populate on the fly.
* If you already have a questionnaireResponse, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx instead
*
* @author Sean Fong
*/
function PrePopWrapperForStorybook(props: PrePopWrapperForStorybookProps) {
const { questionnaire, fhirClient, patient, user } = props;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ interface RequestConfig {
authToken: string | null;
}

/**
* Sample callback function to fetch resources from your source server when using populate() or populateQuestionnaire() from @aehrc/sdc-populate.
* See https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopWrapperForStorybook.tsx#L50-L59 for usage.
*
* @author Sean Fong
*/
export const fetchResourceCallback: FetchResourceCallback = (
query: string,
requestConfig: RequestConfig
Expand Down

0 comments on commit b0cfd87

Please sign in to comment.