Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 17727a4

Browse files
committed
feat: adapt group form field for mobile
1 parent 4398e04 commit 17727a4

File tree

4 files changed

+68
-52
lines changed

4 files changed

+68
-52
lines changed

src/components/FormField/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import ReactSelect from "../../components/ReactSelect";
1313
import DateInput from "../../components/DateInput";
1414
import "./styles.module.scss";
1515

16-
const FormField = ({ field, isGroupField }) => {
16+
const FormField = ({ field }) => {
1717
return (
1818
<Field name={field.name}>
1919
{({ input, meta }) => (
20-
<div styleName={isGroupField ? "field-group-field" : ""}>
21-
{ !field.readonly && (
20+
<div>
21+
{ !field.readonly && (
2222
<label
2323
styleName={
2424
(input.value != "undefined" && input.value !== null && input.value !== "") || meta.active

src/components/FormField/styles.module.scss

-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ input:read-only {
3737
margin-top: 24px;
3838
}
3939

40-
.field-group-field {
41-
width: 45%;
42-
}
43-
4440
.field-error {
4541
@include font-roboto;
4642
width: 100%;

src/components/TCForm/index.jsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ const TCForm = ({
5656
<>
5757
{row.type === FORM_ROW_TYPE.GROUP && (
5858
<div styleName="field-group">
59-
{row.fields.map((field) => {
60-
return (
59+
{row.fields.map((field) => (
60+
<div styleName="field-group-field" key={field.name}>
6161
<FormField
6262
field={fields[field]}
63-
isGroupField={true}
6463
/>
65-
);
66-
})}
64+
</div>
65+
))}
6766
</div>
6867
)}
6968
{row.type === FORM_ROW_TYPE.SINGLE &&
+61-40
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,66 @@
11
@import "styles/include";
22
@import "~react-datepicker/dist/react-datepicker.css";
33

4+
.tc-form {
5+
width: 100%;
6+
}
47

8+
.job-form-fields-container {
9+
padding: 40px 0px 20px;
510

6-
.tc-form {
11+
input:not([type="checkbox"]),
12+
textarea {
13+
margin-bottom: 0px;
14+
}
15+
}
16+
17+
.job-form-fields-wrapper{
718
width: 100%;
19+
max-width: 640px;
20+
margin: 0 auto;
21+
text-align: left;
22+
}
23+
24+
.field-group {
25+
display: flex;
26+
flex-wrap: wrap;
27+
justify-content: space-between;
28+
}
829

9-
.job-form-fields-container {
10-
padding: 40px 0px 20px;
11-
12-
.job-form-fields-wrapper{
13-
width: 100%;
14-
max-width: 640px;
15-
margin: 0 auto;
16-
text-align: left;
17-
}
18-
19-
input:not([type="checkbox"]),
20-
textarea {
21-
margin-bottom: 0px;
22-
}
23-
24-
.field-group {
25-
display: flex;
26-
flex-wrap: wrap;
27-
justify-content: space-between;
28-
}
30+
.field-group-field {
31+
padding: 0 10px;
32+
width: 50%;
33+
}
34+
35+
.field-group-field:first-child {
36+
padding-left: 0;
37+
}
38+
39+
.field-group-field:last-child {
40+
padding-right: 0;
41+
}
42+
43+
.form-actions {
44+
border-top: 1px solid #e9e9e9;
45+
display: flex;
46+
justify-content: flex-start;
47+
flex-direction: row;
48+
align-items: center;
49+
width: 100%;
50+
padding: 16px 0 16px;
51+
52+
:first-child {
53+
margin-left: auto;
2954
}
3055

31-
.form-actions {
32-
border-top: 1px solid #e9e9e9;
33-
display: flex;
34-
justify-content: flex-start;
35-
flex-direction: row;
36-
align-items: center;
37-
width: 100%;
38-
padding: 16px 0 16px;
39-
:first-child {
40-
margin-left: auto;
41-
}
42-
button {
43-
height: 40px;
44-
border-radius: 20px;
45-
line-height: 40px;
46-
}
47-
a {
48-
margin-left: 15px;
49-
}
56+
button {
57+
height: 40px;
58+
border-radius: 20px;
59+
line-height: 40px;
60+
}
61+
62+
a {
63+
margin-left: 15px;
5064
}
5165
}
5266

@@ -58,4 +72,11 @@
5872

5973
.datepicker-wrapper > div:nth-child(2) > div:nth-child(2) {
6074
z-index: 100;
75+
}
76+
77+
@media (max-width: 650px) {
78+
.field-group-field {
79+
padding: 0;
80+
width: 100%;
81+
}
6182
}

0 commit comments

Comments
 (0)