department-of-veterans-affairs/vets-website

View on GitHub
src/applications/simple-forms/20-10207/pages/livingSituation.js

Summary

Maintainability
A
3 hrs
Test Coverage
import {
  checkboxGroupUI,
  checkboxGroupSchema,
} from 'platform/forms-system/src/js/web-component-patterns';
import { LIVING_SITUATIONS } from '../config/constants';
import { validateLivingSituation } from '../helpers';

export default {
  uiSchema: {
    livingSituation: checkboxGroupUI({
      title: 'Which of these statements best describe your living situation?',
      required: true,
      labels: LIVING_SITUATIONS,
      labelHeaderLevel: '3',
      tile: false,
      errorMessages: {
        required: 'Select the appropriate living situation',
      },
    }),
    'ui:validations': [validateLivingSituation],
  },
  schema: {
    type: 'object',
    properties: {
      livingSituation: checkboxGroupSchema(Object.keys(LIVING_SITUATIONS)),
    },
    required: ['livingSituation'],
  },
};