Skip to content

Commit f94177e

Browse files
Merge pull request #1825 from hackforla/dev
Dev
2 parents d42d01f + 671c13e commit f94177e

File tree

3 files changed

+74
-80
lines changed

3 files changed

+74
-80
lines changed

products/statement-generator/public/locales/en/translation.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@
124124
"finalize": "My declaration letter",
125125
"completed": "Completed"
126126
},
127+
"sections_helper_text": {
128+
"job": "Current job(s) full-time, part-time, or self-employed",
129+
"unemployment": "Looking for work and/or difficulty finding work",
130+
"self_improvement": "Counseling, musical/art therapies, health and fitness, or treatment programs",
131+
"education": "School, college, or certification",
132+
"parenting": "Raising a child or children",
133+
"community_service": "Volunteer work at a community organization",
134+
"something_else": "Anything else you want to include"
135+
},
127136
"introduction_form": {
128137
"fullName_input_label": "What is your full name?",
129138
"fullName_input_placeholder": "Firstname Lastname",
@@ -132,7 +141,7 @@
132141
"isVeteran_label": "Are you a veteran of the United States of America?"
133142
},
134143
"involvement_form": {
135-
"checkboxgroup_label": "What have you been involved with since your conviction?\n\nCheck all that apply:",
144+
"checkboxgroup_label": "What have you been involved with since your conviction?\n\nCheck all that apply. You will be able to add more details later.",
136145
"none_above": "None of the above"
137146
},
138147
"job_form": {
Lines changed: 51 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,73 @@
11
import React from 'react';
22
import { makeStyles, createStyles, Theme } from '@material-ui/core';
3-
import { teal } from '@material-ui/core/colors';
3+
import Box from '@material-ui/core/Box';
44
import FormControlLabel from '@material-ui/core/FormControlLabel';
55
import Checkbox, { CheckboxProps } from '@material-ui/core/Checkbox';
6+
import FormHelperText from '@material-ui/core/FormHelperText';
67

7-
interface ICheckboxStyle {
8-
theme?: string;
9-
}
10-
11-
const useStyles = makeStyles<Theme, ICheckboxStyle>(({ palette }) =>
8+
const useStyles = makeStyles<Theme>(({ palette }) =>
129
createStyles({
1310
root: {
14-
color: ({ theme }) => {
15-
switch (theme) {
16-
case 'teal':
17-
return teal.A400;
18-
case 'black':
19-
default:
20-
return palette.common.black;
21-
}
22-
},
11+
display: 'flex',
12+
flexDirection: 'column',
13+
gap: 4,
2314

24-
// hacky because the component is adding the colorSecondary for some reason
25-
'&.MuiCheckbox-colorSecondary.Mui-checked': {
26-
color: ({ theme }) => {
27-
switch (theme) {
28-
case 'teal':
29-
return teal.A400;
30-
case 'black':
31-
default:
32-
return palette.common.black;
33-
}
15+
'& .MuiFormControlLabel-root': {
16+
marginLeft: 0, // Undo default -11px styling
17+
color: palette.primary.darker,
18+
19+
'& .MuiCheckbox-root': {
20+
padding: '0px 8px 0px 0px', // 8px right padding on checkbox
21+
22+
// MUI v4 checkboxes default to secondary
23+
'&.MuiCheckbox-colorSecondary': {
24+
color: palette.primary.darker,
25+
opacity: 0.3,
26+
'&.Mui-checked': {
27+
color: palette.success.main,
28+
opacity: 1,
29+
},
30+
},
3431
},
3532
},
33+
34+
'& .MuiFormHelperText-root': {
35+
marginTop: 0,
36+
marginLeft: 32, // Padding to align with checkbox label
37+
fontSize: '0.875rem',
38+
lineHeight: '1rem',
39+
color: palette.primary.darker,
40+
opacity: 0.75,
41+
},
3642
},
3743
})
3844
);
3945

40-
interface IInnerCheckboxProps extends CheckboxProps {
41-
checked: boolean;
42-
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
43-
id?: string;
44-
useTeal?: boolean;
45-
}
46-
47-
const InnerCheckbox = React.forwardRef<HTMLInputElement, IInnerCheckboxProps>(
48-
({ checked, onChange, id, useTeal }, ref) => {
49-
const classes = useStyles({ theme: useTeal ? 'teal' : 'black' });
50-
return (
51-
<Checkbox
52-
classes={classes}
53-
checked={checked}
54-
onChange={onChange}
55-
id={id}
56-
inputRef={ref}
57-
/>
58-
);
59-
}
60-
);
61-
62-
interface IWrapperCheckboxProps extends IInnerCheckboxProps {
46+
interface IWrapperCheckboxProps extends CheckboxProps {
6347
label: string;
48+
helperText?: string;
6449
}
6550

6651
const CheckboxLabels = React.forwardRef<
6752
HTMLInputElement,
6853
IWrapperCheckboxProps
69-
>(({ label, checked, onChange, id, useTeal = false }, ref) => (
70-
<FormControlLabel
71-
control={
72-
<InnerCheckbox
73-
useTeal={useTeal}
74-
id={id}
75-
checked={checked}
76-
onChange={onChange}
77-
ref={ref}
54+
>(({ label, helperText = '', checked, onChange, id }, ref) => {
55+
const classes = useStyles();
56+
return (
57+
<Box className={classes.root}>
58+
<FormControlLabel
59+
control={
60+
<Checkbox
61+
id={id}
62+
checked={checked}
63+
onChange={onChange}
64+
inputRef={ref}
65+
/>
66+
}
67+
label={label}
7868
/>
79-
}
80-
label={label}
81-
/>
82-
));
83-
69+
{helperText && <FormHelperText>{helperText}</FormHelperText>}
70+
</Box>
71+
);
72+
});
8473
export default CheckboxLabels;

products/statement-generator/src/pages-form/InvolvementInitialFlow.tsx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ import FormStateContext from 'contexts/FormStateContext';
1010
import Checkbox from 'components/Checkbox';
1111
import FormFlowContainer from 'components-layout/FormFlowContainer';
1212

13-
const useStyles = makeStyles<Theme>(({ palette, spacing }) =>
13+
const useStyles = makeStyles<Theme>(({ palette }) =>
1414
createStyles({
1515
checkboxGroup: {
16+
gap: 24,
1617
'& .MuiFormLabel-root': {
17-
color: palette.common.black,
18+
color: palette.primary.darker,
1819
},
1920
'& .MuiFormLabel-root.Mui-focused': {
20-
color: palette.common.black,
21+
color: palette.primary.darker,
2122
},
22-
23-
'& .MuiFormLabel-root + .MuiFormGroup-root': {
24-
marginTop: spacing(1),
23+
'& .MuiFormGroup-root': {
24+
gap: 16,
2525
},
2626
},
2727
})
@@ -79,57 +79,53 @@ function InvolvementInitialFlow() {
7979
</FormLabel>
8080
<FormGroup id="involvement-checkboxes">
8181
<Checkbox
82-
useTeal
8382
id="isJobChecked"
8483
checked={isJobChecked}
8584
onChange={onCheckboxChange}
8685
label={t('sections.job')}
86+
helperText={t('sections_helper_text.job')}
8787
/>
8888
<Checkbox
89-
useTeal
9089
id="isUnemploymentChecked"
9190
checked={isUnemploymentChecked}
9291
onChange={onCheckboxChange}
9392
label={t('sections.unemployment')}
93+
helperText={t('sections_helper_text.unemployment')}
9494
/>
9595
<Checkbox
96-
useTeal
9796
id="isRecoveryChecked"
9897
checked={isRecoveryChecked}
9998
onChange={onCheckboxChange}
10099
label={t('sections.self_improvement')}
100+
helperText={t('sections_helper_text.self_improvement')}
101101
/>
102-
103102
<Checkbox
104-
useTeal
105103
id="isSchoolChecked"
106104
checked={isSchoolChecked}
107105
onChange={onCheckboxChange}
108106
label={t('sections.education')}
107+
helperText={t('sections_helper_text.education')}
109108
/>
110-
111109
<Checkbox
112-
useTeal
113110
id="isParentingChecked"
114111
checked={isParentingChecked}
115112
onChange={onCheckboxChange}
116113
label={t('sections.parenting')}
114+
helperText={t('sections_helper_text.parenting')}
117115
/>
118-
119116
<Checkbox
120-
useTeal
121117
id="isCommunityChecked"
122118
checked={isCommunityChecked}
123119
onChange={onCheckboxChange}
124120
label={t('sections.community_service')}
121+
helperText={t('sections_helper_text.community_service')}
125122
/>
126-
127123
<Checkbox
128-
useTeal
129124
id="isSomethingElseChecked"
130125
checked={isSomethingElseChecked}
131126
onChange={onCheckboxChange}
132127
label={t('sections.something_else')}
128+
helperText={t('sections_helper_text.something_else')}
133129
/>
134130
</FormGroup>
135131
</FormControl>

0 commit comments

Comments
 (0)