# All files / atlas-mobile-ts/src/components/Map/Panels/FilterPanel FilterMinRating.tsx

0% Statements 0/13
0% Branches 0/2
0% Functions 0/4
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46

     ﻿/* Copyright (C) Click & Push Accessibility, Inc - All Rights Reserved
     * Unauthorized copying of this file, via any medium is strictly prohibited
     * Proprietary and confidential
     * Written and maintained by the Click & Push Development team
     * <dev@clicknpush.ca>, January 2022
     */

    import Slider from "@react-native-community/slider";
    import React from "react";
    import { View, Text, TextInput } from "react-native";
    import { IconButton } from "../../../Buttons";

    interface MinRatingProps {
        localMinRating: number
        setLocalMinRating: (number) => void
        cancelChanges: () => void
        toggleFilter: (boolean) => void
    }

    /**
     * Component that offers a slider to set the minimum rating filter
     */
    export const FilterMinRating: React.FC<MinRatingProps> = ({localMinRating, setLocalMinRating, cancelChanges, toggleFilter}) => {
        return (
            <View style={{marginBottom: 10, flexDirection: 'row', justifyContent: 'space-between'}} >
                <View style={{width: '90%'}}>
                    <View style={{marginBottom: 10, justifyContent: 'flex-start'}}>
                        <Text style={{marginTop: 3, marginRight: 10}}>Min rating:</Text>
                        <View style={{flexDirection: 'row'}}>
                            <TextInput value={localMinRating.toString()} keyboardType='numeric' onChangeText={value => {
                                    if (value) {
                                        setLocalMinRating(parseInt(value))
                                    }
                                    else {
                                        setLocalMinRating(0)
                                    }
                                }}
                                style={{width: '10%'}}/>
                            <Slider step={1} value={localMinRating} onSlidingComplete={value => setLocalMinRating(value)} minimumValue={0} maximumValue={1000} style={{width: '90%'}} />
                        </View>
                    </View>
                </View>
                <IconButton style={{justifyContent: 'flex-start'}} icon="times" size={20} color='black' onPress={() => {cancelChanges(); toggleFilter(false)}}/>
            </View>
        )
    }