Passed
Push — feature/experience-step-functi... ( 5abe99...215b5c )
by Tristan
08:04 queued 03:37
created

resources/assets/js/components/Application/ExperienceModals/EducationSubform.tsx   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 95
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 77
mnd 0
bc 0
fnc 1
dl 0
loc 95
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B EducationSubform.tsx ➔ EducationSubform 0 62 1
1
import React from "react";
2
import { FormattedMessage, useIntl, defineMessages } from "react-intl";
3
import { FastField } from "formik";
4
import * as Yup from "yup";
5
import CheckboxInput from "../../Form/CheckboxInput";
6
import textToParagraphs from "../../../helpers/textToParagraphs";
7
import { educationMessages } from "../../JobBuilder/Details/JobDetailsMessages";
8
9
export interface EducationFormValues {
10
  useAsEducationRequirement: boolean;
11
}
12
13
export const validationShape = {
14
  useAsEducationRequirement: Yup.boolean(),
15
};
16
17
export interface EducationSubformProps {
18
  jobClassification: string;
19
}
20
21
const messages = defineMessages({
22
  educationJustificationLabel: {
23
    id:
24
      "application.experienceModal.educationSubform.educationJustificationLabel",
25
    defaultMessage:
26
      "Yes, this experience helps me meet the education requirements outlined below.",
27
    description:
28
      "Label for the checkbox that checks whether to use this experience to as education justification.",
29
  },
30
});
31
32
export function EducationSubform({
33
  jobClassification,
34
}: EducationSubformProps): React.ReactElement {
35
  const intl = useIntl();
36
37
  const checkboxKey = "useAsEducationRequirement";
38
  return (
39
    <>
40
      <div data-c-container="medium">
41
        <p
42
          data-c-margin="top(1) bottom(1)"
43
          data-c-font-size="h4"
44
          data-c-font-weight="bold"
45
          data-c-color="c3"
46
        >
47
          <FormattedMessage
48
            id="application.experienceModal.educationSubtitle"
49
            defaultMessage="Use This Experience as an Education Requirement"
50
            description="Subtitle for the use-as-Education-Requirement section."
51
          />
52
        </p>
53
        <p data-c-margin="bottom(1)">
54
          <FormattedMessage
55
            id="application.experienceModal.educationDescription"
56
            defaultMessage="You can select the option below if you feel that this experience helps you meet some or all of the specific education requirements for this job. We've included the requirements below to help refresh your memory."
57
            description="Explanation for the use-as-Education-Requirement section."
58
          />
59
        </p>
60
      </div>
61
      <div data-c-padding="bottom(1)">
62
        <div data-c-container="medium">
63
          <div data-c-grid="gutter(all, 1) middle">
64
            <div data-c-grid-item="base(1of1)">
65
              <FastField
66
                key={checkboxKey}
67
                id={checkboxKey}
68
                name={checkboxKey}
69
                label={intl.formatMessage(messages.educationJustificationLabel)}
70
                component={CheckboxInput}
71
                checkboxBorder
72
              />
73
            </div>
74
          </div>
75
          <div
76
            data-c-background="gray(20)"
77
            data-c-radius="rounded"
78
            data-c-padding="all(1)"
79
            data-c-margin="bottom(1)"
80
          >
81
            {textToParagraphs(
82
              intl.formatMessage(educationMessages[jobClassification]),
83
              {},
84
              {
85
                0: { "data-c-font-weight": "bold" },
86
                5: { "data-c-font-weight": "bold" },
87
              },
88
            )}
89
          </div>
90
        </div>
91
      </div>
92
    </>
93
  );
94
}
95