Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyfoggy committed Mar 19, 2020
2 parents 2ceee0c + 60c669c commit ce18ab2
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 17 deletions.
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/corona-map",
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
Expand Down
24 changes: 19 additions & 5 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<agm-map [fullscreenControl]="true"
<h2>Поширення COVID-19 в Україні</h2>
<div class="map-wrapper">

<agm-map [fullscreenControl]="true"
(mapClick)="onMapClick($event)"
[maxZoom]="10"
[zoom]="6"
Expand All @@ -10,13 +13,24 @@
<agm-marker (markerClick)="onMarkerClick($event, window)" [iconUrl]="marker.icon" [latitude]="marker.lat" [longitude]="marker.lng">
<agm-info-window #window>
<div class="info-wraper">
<div>{{marker.name}}</div>
<div class="cases-counter">{{marker.cases}} захворювань</div>
<div *ngIf="marker.deaths" class="death-counter">{{marker.deaths}} смертей</div>
<div class="region-name">{{marker.name}}</div>
<div class="cases-counter">захворювань: {{marker.cases}}</div>
<div *ngIf="marker.deaths" class="death-counter">смертей: {{marker.deaths}}</div>
</div>
</agm-info-window>
</agm-marker>

</ng-container>

</agm-map>
</agm-map>

<div class="map-description">
<img src="assets/icons/circle-orange.png" alt="" class="src"><div>- регіон де виявили захворювання на короновірус</div>
</div>
<div class="general-info">
<div style="color: #aaa;">Усього випадків виявлено: {{ casesAll }}</div>
<div style="color: #696969;">Усього смертей: {{ deathsAll }}</div>
</div>
</div>


44 changes: 43 additions & 1 deletion src/app/app.component.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
agm-map {
height: 600px;
width: 1000px;
}
}
h2 {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
color: #555;
}

img {
display: block;
}
.region-name {
font-weight: bold;
padding-bottom: 3px;
}

.death-counter {
font-family: Arial, Helvetica, sans-serif;
}

.cases-counter {
padding-bottom: 3px;
font-family: Arial, Helvetica, sans-serif;
}

.map-description {
display: grid;
grid-template-columns: 35px auto;
margin-top: 15px;
margin-left: 10px;
}

.map-wrapper {
height: 600px;
width: 1000px;
margin: auto;
font-family: Arial, Helvetica, sans-serif;
}

.general-info {
margin-top: 30px;
font-size: 20px;
line-height: 3rem;
}
6 changes: 6 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export class AppComponent implements OnInit {
lat = 48.4070118;
lng = 32.6144772;
markers = [];
casesAll = 0;
deathsAll = 0;
private previous;
constructor(private map: MapService) {
}
Expand All @@ -19,6 +21,10 @@ export class AppComponent implements OnInit {
this.markers = markers.map(marker => {
return {...marker, icon: 'assets/icons/circle-orange.png'};
});
this.markers.forEach(marker => {
if (Number(marker.cases)) { this.casesAll += marker.cases; }
if (Number(marker.deaths)) { this.deathsAll += marker.deaths; }
});
}

public onMarkerClick(e, infowindow) {
Expand Down
37 changes: 27 additions & 10 deletions src/app/app.constants.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
export const markers = [
{
id: 0,
name: 'Харківська область',
lat: 50.02,
lng: 36.14,
cases: 0
},
{
id: 0,
name: 'Київська область',
lat: 50.27,
lng: 30.30,
cases: 7
lng: 30.45,
cases: 2
},
{
id: 2,
name: 'Житомирська область',
lat: 50.05,
lng: 28.63,
cases: 1,
deaths: 1
},
{
id: 2,
name: 'Чернівецька область',
lat: 48.12,
lng: 26.05,
cases: 10,
deaths: 1
},
{
id: 3,
name: 'Донецька область',
lat: 47.85,
lng: 37.73,
cases: 1,
deaths: 0
}
]
];

0 comments on commit ce18ab2

Please sign in to comment.