@autobusal/routes-search 0.0.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/RoutesSearch.tsx +14 -15
  2. package/package.json +1 -1
package/RoutesSearch.tsx CHANGED
@@ -3,12 +3,11 @@ import { TFunction } from 'i18next';
3
3
  import { useForm } from 'react-hook-form';
4
4
  import { FaArrowUp, FaHistory } from 'react-icons/fa';
5
5
  import { AiOutlineSearch } from 'react-icons/ai';
6
- import { Button } from '@autobusal/common';
7
- import { display, createDate } from '@autobusal/utilities';
8
- import { Autocomplete, Calendar, Passengers } from '@autobusal/common';
6
+ import { Button, Autocomplete, Calendar, Passengers } from '@autobusal/common';
7
+ import { Display, createDate } from '@autobusal/utilities';
9
8
  import { Options, Columns, Column, Item, Title, Action } from './styles';
10
- import { RoutesSearchForm } from './types';
11
9
  import { AutocompleteData } from '@autobusal/common/Autocomplete/types';
10
+ import { RoutesSearchForm } from './types';
12
11
  import { GetSuggestions } from './services';
13
12
 
14
13
  interface Props {
@@ -17,14 +16,14 @@ interface Props {
17
16
  to: string
18
17
  departure: string
19
18
  _return: string
20
- adults: number
21
- children: number
22
- babies: number
19
+ adultsNo: number
20
+ childrenNo: number
21
+ babiesNo: number
23
22
  t: TFunction<'common'>
24
23
  onSearch: (data: RoutesSearchForm) => void
25
24
  }
26
25
 
27
- const RoutesSearch = ({ type, from, to, departure, _return, adults, children, babies, t, onSearch }: Props): JSX.Element => {
26
+ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo, babiesNo, t, onSearch }: Props): JSX.Element => {
28
27
  const [ selected, setSelected ] = useState<'departure' | 'return'>(type);
29
28
 
30
29
  const { register, handleSubmit, formState: { errors }, setValue } = useForm<RoutesSearchForm>();
@@ -101,7 +100,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adults, children, ba
101
100
  onUpdate={ setValue }
102
101
  />
103
102
 
104
- { display(errors.from) }
103
+ { Display(errors.from) }
105
104
  </Item>
106
105
 
107
106
  <Item>
@@ -117,7 +116,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adults, children, ba
117
116
  onUpdate={ setValue }
118
117
  />
119
118
 
120
- { display(errors.to) }
119
+ { Display(errors.to) }
121
120
  </Item>
122
121
  </Column>
123
122
 
@@ -135,7 +134,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adults, children, ba
135
134
  onUpdate={ setValue }
136
135
  />
137
136
 
138
- { display(errors.departure) }
137
+ { Display(errors.departure) }
139
138
  </Item>
140
139
 
141
140
  { selected === 'return' && (
@@ -152,7 +151,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adults, children, ba
152
151
  onUpdate={ setValue }
153
152
  />
154
153
 
155
- { display(errors._return) }
154
+ { Display(errors._return) }
156
155
  </Item>
157
156
  ) }
158
157
  </Column>
@@ -162,9 +161,9 @@ const RoutesSearch = ({ type, from, to, departure, _return, adults, children, ba
162
161
  <Title>{ t('routes_search.passengers', { ns: 'common' }) }</Title>
163
162
 
164
163
  <Passengers
165
- defaultAdults={ adults }
166
- defaultChildren={ children }
167
- defaultBabies={ babies }
164
+ defaultAdults={ adultsNo }
165
+ defaultChildren={ childrenNo }
166
+ defaultBabies={ babiesNo }
168
167
  t={ t }
169
168
  refs={ register }
170
169
  onUpdate={ setValue }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-search",
3
- "version": "0.0.6",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }