-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestLL.js
161 lines (156 loc) · 3.57 KB
/
testLL.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import React from "react";
import styled from "styled-components";
import magnifyingGlass from "../../../assets/magnifying.png";
const FormStyle = styled.form`
display: flex;
background-color: #e71242;
color: white;
flex-direction: column;
padding: 2%;
height: 33vh;
`;
const FlexRow = styled.div`
display: inherit;
flex-direction: row;
margin-top: 3vh;
justify-content: space-around;
`;
const PostcodeSearchBar = styled.input`
display: flex;
align-self: center;
padding: 1%;
margin: 2%;
width: 75vw;
height: 6vh;
background-color: #e71242;
border: 2px solid white;
font: lato;
color: white;
font-size: 1.2rem;
margin-top: 2em;
&::placeholder {
color: white;
}
`;
const Radio = styled.input`
display: none;
text-align: center;
`;
const FakeRadio = styled.label`
display: table;
width: 20vw;
height: 4vh;
padding: 2%;
color: white;
background: #e71242;
border: 2px solid white;
text-align: center;
`;
const FakeRadioOn = styled.label`
display: table;
width: 20vw;
height: 4vh;
padding: 2%;
color: #e71242;
background: white;
border: 2px solid #e71242;
text-align: center;
`;
const Submit = styled.button`
display: flex;
color: white;
background-color: none;
`;
const Question = styled.p`
padding-top: 3.2em;
font-size: 1rem;
margin: 0 auto;
`;
const LabelSmall = styled.label`
font-size: 1rem;
margin: 0 auto;
padding-top: 1em;
`;
const Padding = styled.div`
margin: 5%;
padding-top: 2em;
`;
const CheckBox = styled.input`
color: #e71242;
border: 2px solid white;
margin-left 5%;
margin-bottom: 0;
`;
const SearchForm = ({ ...props }) => {
return (
<FormStyle>
{props.postcodeErrorMsg ? <p>{props.postcodeErrorMsg}</p> : ""}
<FlexRow>
<PostcodeSearchBar
type="text"
name="postcode"
placeholder="Enter your postcode"
value={props.postcode}
onChange={props.handleChange}
/>
<Submit type="submit" onClick={props.checkPostcode}>
<img
src={magnifyingGlass}
width={40}
height={40}
vertical-align="center"
/>
</Submit>
</FlexRow>
<Question>When do you need food? </Question>
<FlexRow>
{props.timeOption == "today" ? (
<FakeRadioOn htmlFor="today">Today</FakeRadioOn>
) : (
<FakeRadio htmlFor="today">Today</FakeRadio>
)}
<Radio
id="today"
type="radio"
name="time"
value="today"
onChange={props.handleTime}
/>
{props.timeOption == "tomorrow" ? (
<FakeRadioOn htmlFor="tomorrow">Tomorrow</FakeRadioOn>
) : (
<FakeRadio htmlFor="tomorrow">Tomorrow</FakeRadio>
)}
<Radio
id="tomorrow"
type="radio"
name="time"
value="tomorrow"
onChange={props.handleTime}
/>
{props.timeOption == "later" ? (
<FakeRadioOn htmlFor="later">Later</FakeRadioOn>
) : (
<FakeRadio htmlFor="later">Later</FakeRadio>
)}
<Radio
id="later"
type="radio"
name="time"
value="later"
onChange={props.handleTime}
/>
</FlexRow>
<Padding>
<LabelSmall htmlFor="advice-centres">See advice centres</LabelSmall>
<CheckBox
id="advice-centres"
type="checkbox"
name="advice-centres"
onChange={props.toggleAdviceCentres}
/>
</Padding>
</FormStyle>
);
};
export default SearchForm;