<commit_before>import React, {Component} from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { setFilters } from 'actions';
import SearchBar from "../components/search_bar";
import Filter from "../components/filter_link";
import DropdownFilter from "../components/filter_dropdown";


class FiltersContainer extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        return (
            <div className="col-sm-3">
                <SearchBar/>
                {this.renderCategories()}
            </div>
        );
    }

    renderCategories() {
        return FilterCategories.map((category) => {
            return (
                <div key={category.title}>
                    <h3>{category.title}</h3>
                    {this.renderFilters(category)}
                </div>
            );
        });

    }

    renderFilters(category){
            switch (category.type) {
                case 'link':
                    return category.properties.map((property) => {
                        return (
                            <Filter
                                key={property}
                                name={property}
                                onClick={() => this.handleFilterClick(property)}

                            />
                        );
                    });
                case 'dropdown':
                    return (
                        <DropdownFilter options={category.options}/>
                    );
                default:
                    break;
            }

    }

    handleFilterClick(property){
        this.props.setFilters(property);
    }


}

const FilterCategories = [
    {
        'title' : 'Location',
        'type' : 'link',
        'properties' : ['Dallas', 'Austin', 'Houston']
    },
    {
        'title' : 'Elevation',
        'type' : 'dropdown',
        'options' : [
            {'value' : '50', 'label' : '<50'},
            {'value' : '150', 'label' : '<150'},
            {'value' : '500', 'label' : '150+'},
        ]
    }

];
//export default FiltersContainer;

function mapStateToProps(state) {
    return {
        filters: state.activeFilters
    }
}

function mapDispatchToProps(dispatch) {
    return bindActionCreators({setFilters: setFilters}, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(FiltersContainer);<commit_msg>dropdown filter<commit_after>import React, {Component} from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { setFilters } from 'actions';
import SearchBar from "../components/search_bar";
import Filter from "../components/filter_link";
import DropdownFilter from "../components/filter_dropdown";


class FiltersContainer extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        return (
            <div className="col-sm-3">
                <SearchBar/>
                {this.renderCategories()}
            </div>
        );
    }

    renderCategories() {
        return FilterCategories.map((category) => {
            return (
                <div key={category.title}>
                    <h3>{category.title}</h3>
                    {this.renderFilters(category)}
                </div>
            );
        });

    }

    renderFilters(category){
            switch (category.type) {
                case 'link':
                    return category.properties.map((property) => {
                        return (
                            <Filter
                                key={property}
                                name={property}
                                onClick={() => this.handleFilterClick(property)}

                            />
                        );
                    });
                case 'dropdown':
                    return (
                        <DropdownFilter options={category.options}/>
                    );
                default:
                    break;
            }

    }

    handleFilterClick(property){
        this.props.setFilters(property);
    }


}

const FilterCategories = [
    {
        'title' : 'Location',
        'type' : 'link',
        'properties' : ['Dallas', 'Austin', 'Houston']
    },
    {
        'title' : 'Elevation',
        'type' : 'dropdown',
        'options' : [
            {'value' : '50', 'label' : '<50'},
            {'value' : '150', 'label' : '<150'},
            {'value' : '151', 'label' : '>150'},
        ]
    }

];
//export default FiltersContainer;

function mapStateToProps(state) {
    return {
        filters: state.activeFilters
    }
}

function mapDispatchToProps(dispatch) {
    return bindActionCreators({setFilters: setFilters}, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(FiltersContainer);
{'fraction_non_alphanumeric': 0.1276073619631902, 'fraction_numerical': 0.007770961145194274, 'mean_word_length': 1.4553212851405624, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4436691', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1211, 'n_words': 236}