Skip to content

Commit

Permalink
add support for instructions text for govus
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmars committed Oct 2, 2023
1 parent e131e20 commit 274e87b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/govus/public/case2.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
elem.appendChild(mytag);
}
var id = new URLSearchParams(window.location.search).get("case");
startcase("OPGO8L-CARINSUR-WORK " + id);
startcase("SSA-ICLAIMS-WORK " + id);
</script>
</body>

Expand Down
11 changes: 11 additions & 0 deletions packages/govus/src/layout.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
/* global i18n */
import { html } from 'lit';
import { unsafeHTML } from 'lit/directives/unsafe-html';

import { Field } from './fields';
import { SimpleTable, DisplayList } from './lists';

const Instructions = (paragraph, webcomp) => {
if (!paragraph) return null;
const paragraphObj = webcomp.data.uiResources.resources.paragraphs[paragraph.replace('@PARAGRAPH ', '')];
if (typeof paragraphObj === 'object' && paragraphObj.length === 1 && paragraphObj[0].content) {
return html`${unsafeHTML(paragraphObj[0].content)}`;
}
return null;
};
export const Layout = (data, path, isReadOnly, webcomp, context) => {
if (typeof data === 'undefined') return null;
if (Array.isArray(data) && data.length === 1 && data[0].type === 'View') {
Expand Down Expand Up @@ -33,6 +43,7 @@ export const Layout = (data, path, isReadOnly, webcomp, context) => {
case 'DefaultForm':
return html`
<div>
${Instructions(data.config.instructions, webcomp)}
${Layout(data.children[0].children, `${path}-0`, isReadOnly, webcomp, context)}
</div>
`;
Expand Down

0 comments on commit 274e87b

Please sign in to comment.