Skip to content

Commit

Permalink
feat: add photo to bar
Browse files Browse the repository at this point in the history
  • Loading branch information
raulghm committed May 18, 2019
1 parent 089fb2c commit a11af02
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/components/StoreItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
</div>
</div>
<div class="StoreItem-image" :style="{ 'background-image': 'url(' + imagePlaceholder + ')' }"></div>
<div class="StoreItem-image" :style="{ 'background-image': 'url(' + getPhoto(photo) + ')' }"></div>
</div>
</router-link>
</template>
Expand All @@ -34,7 +34,7 @@ export default {
type: String,
required: true
},
image: {
photo: {
type: String
},
name: {
Expand All @@ -51,11 +51,11 @@ export default {
}
},
data: () => ({
imagePlaceholder: '/img/img-bar.jpg'
}),
methods: {}
methods: {
getPhoto (photo) {
return photo && photo.length ? photo : '/img/img-bar.jpg'
}
}
}
</script>

Expand Down
11 changes: 10 additions & 1 deletion src/graphql/FindByProximity.gql
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
query findByProximity($latitude: Float!, $longitude: Float!) {
query findByProximity(
$latitude: Float!,
$longitude: Float!,
$googleMapsKey: String!
) {
findByProximity(
latitude: $latitude
longitude: $longitude
) {
_id
name
address
place {
photo(
key: $googleMapsKey
)
}
matrix(
latitude: $latitude
longitude: $longitude
Expand Down
5 changes: 3 additions & 2 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:name="store.name"
:address="store.address"
:distance="store.matrix.distance"
:image="store.image"
:photo="store.place.photo"
/>
</transition-group>
</div>
Expand All @@ -41,7 +41,8 @@ export default {
variables () {
return {
latitude: this.$store.state.userData.lat,
longitude: this.$store.state.userData.long
longitude: this.$store.state.userData.long,
googleMapsKey: process.env.VUE_APP_GOOGLE_MAPS_KEY
}
},
update ({ findByProximity }) {
Expand Down

0 comments on commit a11af02

Please sign in to comment.