@autobusal/map 0.0.1 → 0.0.2
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.
- package/Column/Column.tsx +2 -3
- package/Column/styles.ts +4 -3
- package/Display/Display.tsx +2 -3
- package/Display/styles.ts +3 -3
- package/Map.tsx +1 -4
- package/package.json +1 -1
package/Column/Column.tsx
CHANGED
|
@@ -11,7 +11,6 @@ import { CityData } from '@autobusal/providers/types';
|
|
|
11
11
|
import { SearchForm } from '../types';
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
|
-
top: number
|
|
15
14
|
from: CityData | null
|
|
16
15
|
to: CityData | null
|
|
17
16
|
t: TFunction<'common'>
|
|
@@ -19,7 +18,7 @@ interface Props {
|
|
|
19
18
|
onResetAll: () => void
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
const Column = ({
|
|
21
|
+
const Column = ({ from, to, t, onReset, onResetAll }: Props): JSX.Element => {
|
|
23
22
|
const { register, handleSubmit, formState: { errors }, setValue } = useForm<SearchForm>();
|
|
24
23
|
|
|
25
24
|
const navigate = useNavigate();
|
|
@@ -39,7 +38,7 @@ const Column = ({ top, from, to, t, onReset, onResetAll }: Props): JSX.Element =
|
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
return (
|
|
42
|
-
<Container className="box"
|
|
41
|
+
<Container className="box column">
|
|
43
42
|
<form onSubmit={ handleSubmit(onSubmit) }>
|
|
44
43
|
<Items>
|
|
45
44
|
<Item className="row">
|
package/Column/styles.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const Container = styled.div
|
|
4
|
-
position:
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
position: fixed;
|
|
5
5
|
left: 0;
|
|
6
6
|
bottom: 0;
|
|
7
7
|
z-index: 6;
|
|
8
8
|
width: 100%;
|
|
9
|
-
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
10
11
|
background: ${ props => props.theme.header.transparent };
|
|
11
12
|
backdrop-filter: blur(20px);
|
|
12
13
|
-webkit-backdrop-filter: blur(20px);
|
package/Display/Display.tsx
CHANGED
|
@@ -4,14 +4,13 @@ import { Container } from './styles';
|
|
|
4
4
|
import { CityData } from '@autobusal/providers/types';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
top: number
|
|
8
7
|
cities: CityData[]
|
|
9
8
|
from: CityData | null
|
|
10
9
|
to: CityData | null
|
|
11
10
|
onClick: (item: CityData) => void
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const Display = ({
|
|
13
|
+
const Display = ({ cities, from, to, onClick }: Props): JSX.Element => {
|
|
15
14
|
const markers = cities.map((item, index) => (
|
|
16
15
|
<Marker key={ index } position={ getPosition(item.location) } eventHandlers={{ click: () => { onClick(item) } }}>
|
|
17
16
|
<Popup>{ item.name }</Popup>
|
|
@@ -21,7 +20,7 @@ const Display = ({ top, cities, from, to, onClick }: Props): JSX.Element => {
|
|
|
21
20
|
const line = drawLine(from, to);
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
|
-
<Container
|
|
23
|
+
<Container>
|
|
25
24
|
<MapContainer center={[ 41.32, 19.81 ]} minZoom={ 6 } maxZoom={ 13 } zoom={ 6 } scrollWheelZoom={ true }>
|
|
26
25
|
<TileLayer attribution="© <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors" url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
|
27
26
|
|
package/Display/styles.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import 'leaflet/dist/leaflet.css';
|
|
3
3
|
|
|
4
|
-
export const Container = styled.div
|
|
4
|
+
export const Container = styled.div`
|
|
5
5
|
position: fixed;
|
|
6
|
-
top:
|
|
6
|
+
top: 0;
|
|
7
7
|
left: 0;
|
|
8
8
|
z-index: 5;
|
|
9
9
|
width: 100%;
|
|
10
|
-
height:
|
|
10
|
+
height: 100%;
|
|
11
11
|
|
|
12
12
|
& > .leaflet-container {
|
|
13
13
|
width: 100%;
|
package/Map.tsx
CHANGED
|
@@ -7,11 +7,10 @@ import { CityData } from '@autobusal/providers/types';
|
|
|
7
7
|
import { GetLocations } from './services';
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
|
-
top: number
|
|
11
10
|
t: TFunction<'common'>
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const Map = ({
|
|
13
|
+
const Map = ({ t }: Props): JSX.Element => {
|
|
15
14
|
const [ from, setFrom ] = useState<CityData | null>(null);
|
|
16
15
|
const [ to, setTo ] = useState<CityData | null>(null);
|
|
17
16
|
|
|
@@ -41,7 +40,6 @@ const Map = ({ top, t }: Props): JSX.Element => {
|
|
|
41
40
|
return (
|
|
42
41
|
<Meta title={ t('map.title') }>
|
|
43
42
|
<Column
|
|
44
|
-
top={ top }
|
|
45
43
|
from={ from }
|
|
46
44
|
to={ to }
|
|
47
45
|
t={ t }
|
|
@@ -50,7 +48,6 @@ const Map = ({ top, t }: Props): JSX.Element => {
|
|
|
50
48
|
/>
|
|
51
49
|
|
|
52
50
|
<Display
|
|
53
|
-
top={ top }
|
|
54
51
|
cities={ data }
|
|
55
52
|
from={ from }
|
|
56
53
|
to={ to }
|