Skip to content

Commit

Permalink
feat: add is open now
Browse files Browse the repository at this point in the history
  • Loading branch information
raulghm committed May 18, 2019
1 parent a11af02 commit 63f368f
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 9 deletions.
21 changes: 17 additions & 4 deletions src/components/StoreItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
<span>{{distance.replace(',', '.')}}</span>
</div>
</div>
<div class="StoreItem-header-status">
<div
class="StoreItem-header-status"
:class="{'StoreItem-header-status--isActive': openNow}"
>
<i class="ico-time"></i>
<span>Abierto</span>
<span>
{{ openNow ? 'Abierto' : 'Cerrado' }}
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -48,6 +53,10 @@ export default {
distance: {
type: String,
required: true
},
openNow: {
type: Boolean,
required: true
}
},
Expand Down Expand Up @@ -121,7 +130,7 @@ export default {
font-family: var(--font-family-primary);
font-weight: bold;
text-transform: uppercase;
color: var(--color-green);
color: var(--color-red);
font-size: 0.8rem;
}
Expand All @@ -131,7 +140,11 @@ export default {
.StoreItem-header-status span {
letter-spacing: 0.4px;
margin-left: 4px;
}
.StoreItem-header-status--isActive span,
.StoreItem-header-status--isActive i {
color: var(--color-green);
}
.StoreItem-image {
Expand Down
24 changes: 19 additions & 5 deletions src/components/StoreItemFull.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<template>
<div class="StoreItemFull">
<div class="StoreItemFull-status">
<div
class="StoreItemFull-status"
:class="{'StoreItemFull-status--isActive': openNow}"
>
<i class="ico-time"></i>
<span>Abierto</span>
<span>
{{ openNow ? 'Abierto' : 'Cerrado' }}
</span>
</div>
<div class="StoreItemFull-name">
{{name}}
Expand Down Expand Up @@ -32,7 +37,12 @@ export default {
required: true
},
distance: {
type: String
type: String,
required: true
},
openNow: {
type: Boolean,
required: true
}
},
Expand Down Expand Up @@ -100,17 +110,21 @@ export default {
font-family: var(--font-family-primary);
font-weight: bold;
text-transform: uppercase;
color: var(--color-green);
color: var(--color-red);
font-size: 0.8rem;
}
.StoreItemFull-status i {
vertical-align: -3px;
font-size: .9rem;
color: var(--color-green);
}
.StoreItemFull-status span {
letter-spacing: .4px;
}
.StoreItemFull-status--isActive span,
.StoreItemFull-status--isActive i {
color: var(--color-green);
}
</style>
3 changes: 3 additions & 0 deletions src/graphql/FindByProximity.gql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ query findByProximity(
name
address
place {
schedule {
openNow
}
photo(
key: $googleMapsKey
)
Expand Down
5 changes: 5 additions & 0 deletions src/graphql/FindOne.gql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ query findOne(
_id
name
address
place {
schedule {
openNow
}
}
geometry {
coordinates
}
Expand Down
1 change: 1 addition & 0 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:address="store.address"
:distance="store.matrix.distance"
:photo="store.place.photo"
:openNow="store.place.schedule.openNow"
/>
</transition-group>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/views/Store.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
:name="findOne.name"
:address="findOne.address"
:distance="getMatrix(findOne.matrix, 'driving', 'distance')"
:openNow="findOne.place.schedule.openNow"
/>

<div class="Store-arriving">
Expand Down

0 comments on commit 63f368f

Please sign in to comment.