-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated results to include filters per #14
- Loading branch information
Showing
6 changed files
with
221 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<template> | ||
<div> | ||
<md-button> | ||
<strong v-on:click="showHide"> | ||
Filter Results | ||
</strong> | ||
</md-button> | ||
<md-card class="md-layout-item md-size-100 md-small-size-100" v-if="showFilters"> | ||
<md-card-content> | ||
<h3>Room Types</h3> | ||
<md-checkbox | ||
v-for="room in roomTypes" | ||
:key="room" | ||
v-model="filters.roomType" | ||
v-bind:value="room" | ||
@change="updateFilters"> | ||
{{room}} | ||
</md-checkbox> | ||
</md-card-content> | ||
<md-card-content> | ||
<h3>Amenities</h3> | ||
<div> | ||
<md-checkbox | ||
v-for="amenity in currentAmenities.slice(0,10)" | ||
:key="amenity" | ||
v-model="filters.amenities" | ||
v-bind:value="amenity" | ||
@change="updateFilters"> | ||
{{amenity}} | ||
</md-checkbox> | ||
</div> | ||
</md-card-content> | ||
<md-card-content> | ||
<h3>Pricing</h3> | ||
<div> | ||
<label for="fname">Set Max Price</label> | ||
<input | ||
type="range" | ||
min="0" | ||
max="1000" | ||
step="1" | ||
v-model.number="maxPrice" | ||
@change="updateFilters"> | ||
${{ maxPrice }} | ||
</div> | ||
</md-card-content> | ||
</md-card> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapState } from 'vuex' | ||
export default { | ||
name: "Filters", | ||
data: () => ({ | ||
showFilters: false, | ||
filters: {"roomType":[], "amenities": [], "priceRange": []}, | ||
roomTypes: [ | ||
"Entire home/apt", | ||
"Private room", | ||
"Shared room", | ||
"Hotel room" | ||
], | ||
maxPrice: 1000 | ||
}), | ||
computed: | ||
mapState({ | ||
currentAmenities: state => state.map.currentAmenities, | ||
}), | ||
methods: { | ||
showHide: function() { | ||
this.showFilters = !this.showFilters; | ||
}, | ||
updateFilters: function() { | ||
this.filters.priceRange = [0, this.maxPrice] | ||
this.$store.dispatch("map/setFilters", this.filters); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.md-checkbox { | ||
display: inline-flex; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div> | ||
<md-button> | ||
<strong v-on:click="showHide"> | ||
{{ showEvents ? "Hide" : "Show" }} log events: | ||
</strong> | ||
</md-button> | ||
<transition name="fade" v-if=showEvents> | ||
<pre>{{moveEvents.join('\n')}}</pre> | ||
</transition> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters