Added results button to compact filters.
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
<RangeFilter
|
||||
label="bra size"
|
||||
:min="0"
|
||||
:max="braSizes.length - 1"
|
||||
:max="cups.length - 1"
|
||||
:value="filters.braSize"
|
||||
:values="braSizes"
|
||||
:values="cups"
|
||||
:disabled="!filters.braSizeRequired"
|
||||
@enable="(checked) => emit('update', 'braSizeRequired', checked, true)"
|
||||
@input="(range) => emit('update', 'braSize', range, false)"
|
||||
@@ -44,17 +44,31 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
import RangeFilter from '#/components/filters/range.vue';
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
filters: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
// cup range should probably not be used, because it becomes impossible to filter for larger values than the current results
|
||||
cupRange: {
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
function cupRangeToCups(cupA, cupB) {
|
||||
const smallestCode = cupA.charCodeAt(0);
|
||||
const biggestCode = cupB.charCodeAt(0);
|
||||
|
||||
return Array.from({ length: biggestCode - smallestCode + 1 }, (value, index) => String.fromCharCode(smallestCode + index));
|
||||
}
|
||||
|
||||
const emit = defineEmits(['update']);
|
||||
|
||||
const braSizes = 'ABCDEFGHIJKZ'.split('');
|
||||
const naturalBoobsValues = [true, undefined, false];
|
||||
const cups = computed(() => (props.cupRange ? cupRangeToCups(props.cupRange[0], props.cupRange[1]) : 'ABCDEFGHIJKZ'.split(''))); // add Z to allow for 'bigger than K' without wasting fidelity
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user