Skip to content

Commit c7dec46

Browse files
committed
Prettier
1 parent 9a90ebf commit c7dec46

File tree

5 files changed

+92
-55
lines changed

5 files changed

+92
-55
lines changed

src/app/components/contact-info/contact-info.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import {useIntl} from 'react-intl';
44
import SchoolSelector from '~/components/school-selector/school-selector';
55
import './contact-info.scss';
66

7-
export default function ContactInfo({children}: React.PropsWithChildren<Record<never, never>>) {
7+
export default function ContactInfo({
8+
children
9+
}: React.PropsWithChildren<Record<never, never>>) {
810
const {formatMessage} = useIntl();
911

1012
return (

src/app/components/dialog/dialog.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import RawHTML from '~/components/jsx-helpers/raw-html';
44
import cn from 'classnames';
55
import './dialog.scss';
66

7-
function PutAway({noTitle, onClick}: {
7+
function PutAway({
8+
noTitle,
9+
onClick
10+
}: {
811
noTitle?: boolean;
912
onClick?: () => void;
1013
}) {

src/app/components/faq-section/faq-section.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import React from 'react';
22
import AccordionGroup from '~/components/accordion-group/accordion-group';
33

4-
export default function FAQ({heading, items}: {
4+
export default function FAQ({
5+
heading,
6+
items
7+
}: {
58
heading: string;
69
items: Parameters<typeof AccordionGroup>[0]['items'];
710
}) {
811
return (
9-
<div className='boxed'>
12+
<div className="boxed">
1013
<h1>{heading}</h1>
1114
<div className="articles">
1215
<AccordionGroup items={items} noScroll />

src/app/components/form-checkboxgroup/form-checkboxgroup.tsx

+46-27
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,56 @@ import React from 'react';
33
type Item = {
44
label: string;
55
value: string;
6-
}
6+
};
77

8-
function Option({item, name, onChange, checked}: {
8+
function Option({
9+
item,
10+
name,
11+
onChange,
12+
checked
13+
}: {
914
item: Item;
1015
name: string;
1116
onChange?: React.ChangeEventHandler<HTMLInputElement>;
1217
checked: boolean;
1318
}) {
14-
const inputProps = item.value ? {
15-
name,
16-
value: item.value
17-
} : {};
19+
const inputProps = item.value
20+
? {
21+
name,
22+
value: item.value
23+
}
24+
: {};
1825

1926
return (
2027
<div className="checkbox-control-group">
2128
<label>
22-
<input type="checkbox" {...inputProps} checked={checked} onChange={onChange} />
29+
<input
30+
type="checkbox"
31+
{...inputProps}
32+
checked={checked}
33+
onChange={onChange}
34+
/>
2335
{item.label}
2436
</label>
2537
</div>
2638
);
2739
}
2840

29-
export default function FormCheckboxgroup(
30-
{name, label, longLabel, instructions, options, onChange}: {
31-
name: string;
32-
label?: string;
33-
longLabel?: string;
34-
instructions?: string;
35-
options: Item[];
36-
onChange?: (arr: unknown[]) => void;
37-
}
38-
) {
41+
export default function FormCheckboxgroup({
42+
name,
43+
label,
44+
longLabel,
45+
instructions,
46+
options,
47+
onChange
48+
}: {
49+
name: string;
50+
label?: string;
51+
longLabel?: string;
52+
instructions?: string;
53+
options: Item[];
54+
onChange?: (arr: unknown[]) => void;
55+
}) {
3956
const checkedItems = React.useMemo(() => new window.Set(), []);
4057
const onItemChange = React.useCallback(
4158
({target: {value, checked}}: React.ChangeEvent<HTMLInputElement>) => {
@@ -50,17 +67,19 @@ export default function FormCheckboxgroup(
5067
return (
5168
<div className="form-checkboxgroup">
5269
{label && <label className="field-label">{label}</label>}
53-
{longLabel && <label className="field-long-label">{longLabel}</label>}
70+
{longLabel && (
71+
<label className="field-long-label">{longLabel}</label>
72+
)}
5473
{instructions && <label className="hint">{instructions}</label>}
55-
{
56-
options.map((item) =>
57-
<Option
58-
item={item} name={name} key={item.value}
59-
checked={checkedItems.has(item.value)}
60-
onChange={onItemChange}
61-
/>
62-
)
63-
}
74+
{options.map((item) => (
75+
<Option
76+
item={item}
77+
name={name}
78+
key={item.value}
79+
checked={checkedItems.has(item.value)}
80+
onChange={onItemChange}
81+
/>
82+
))}
6483
</div>
6584
);
6685
}

src/app/components/form-elements/form-elements.tsx

+34-24
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import useSelectList from '~/helpers/use-select-list';
33
import cn from 'classnames';
44
import './form-elements.scss';
55

6-
function Option({text, active, onClick}: {
6+
function Option({
7+
text,
8+
active,
9+
onClick
10+
}: {
711
text: string;
812
active: boolean;
9-
onClick?: React.MouseEventHandler<HTMLDivElement>
13+
onClick?: React.MouseEventHandler<HTMLDivElement>;
1014
}) {
1115
const ref = React.useRef<HTMLDivElement>(null);
1216

@@ -17,12 +21,7 @@ function Option({text, active, onClick}: {
1721
}, [active]);
1822

1923
return (
20-
<div
21-
className={cn({active})}
22-
role="option"
23-
onClick={onClick}
24-
ref={ref}
25-
>
24+
<div className={cn({active})} role="option" onClick={onClick} ref={ref}>
2625
{text}
2726
</div>
2827
);
@@ -31,29 +30,37 @@ function Option({text, active, onClick}: {
3130
type OptionType = {
3231
label: string;
3332
value: string;
34-
}
33+
};
3534

36-
function SuggestionList({options, activeIndex, accept}: {
35+
function SuggestionList({
36+
options,
37+
activeIndex,
38+
accept
39+
}: {
3740
options: OptionType[];
3841
accept: (o: OptionType) => void;
3942
activeIndex: number;
4043
}) {
4144
return (
4245
<div className="suggestion-list" role="listbox">
43-
{
44-
options.map((opt, i) =>
45-
<Option
46-
key={opt.value} active={activeIndex === i}
47-
onClick={() => accept(opt)}
48-
text={opt.label}
49-
/>
50-
)
51-
}
46+
{options.map((opt, i) => (
47+
<Option
48+
key={opt.value}
49+
active={activeIndex === i}
50+
onClick={() => accept(opt)}
51+
text={opt.label}
52+
/>
53+
))}
5254
</div>
5355
);
5456
}
5557

56-
export function FilteringSelect({options, inputProps, accept, accepted}: {
58+
export function FilteringSelect({
59+
options,
60+
inputProps,
61+
accept,
62+
accepted
63+
}: {
5764
options: OptionType[];
5865
inputProps: JSX.IntrinsicAttributes;
5966
accept: (o: unknown) => void;
@@ -85,10 +92,13 @@ export function FilteringSelect({options, inputProps, accept, accepted}: {
8592
return (
8693
<div className="input-with-suggestions">
8794
<input type="text" {...inputProps} onKeyDown={wrappedKeyDown} />
88-
{
89-
!accepted &&
90-
<SuggestionList options={options} activeIndex={activeIndex} accept={accept} />
91-
}
95+
{!accepted && (
96+
<SuggestionList
97+
options={options}
98+
activeIndex={activeIndex}
99+
accept={accept}
100+
/>
101+
)}
92102
</div>
93103
);
94104
}

0 commit comments

Comments
 (0)