{"size": 2491, "ext": "js", "max_stars_repo_path": "client/src/components/pages/Search/Search.js", "max_stars_repo_name": "rawand-faraidun/mathwithscience", "max_stars_repo_stars_event_min_datetime": "2021-10-14T22:54:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-14T22:54:59.000Z", "max_issues_repo_path": "client/src/components/pages/Search/Search.js", "max_issues_repo_name": "rawand-faraidun/mathwithscience", "max_issues_repo_issues_event_min_datetime": "2021-10-14T22:44:27.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-14T22:44:27.000Z", "max_forks_repo_path": "client/src/components/pages/Search/Search.js", "max_forks_repo_name": "rawand-faraidun/mathwithscience", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 35.0845070423, "max_line_length": 159, "alphanum_fraction": 0.619831393}
import React from 'react'
import { useParams } from 'react-router-dom'
import { Helmet } from 'react-helmet'

import './search.css'
import ListView from '../others/List-View/List-View'
import languageHelper from '../../partials/helpers/Language'
const Calculators = require('../../DATA/Calculators')
const Collections = require('../../DATA/Collections')



// component content
const componentContent = {
    en: {
        title: 'Search',
        description: 'list of Search results'
    },
    kr: {
        title: 'گەڕانکردن',
        description: 'لیستی ئەنجامی گەڕانەکە'
    }
}




/**
 *  @return {Element} : Search route
 */
export default function CalculatorsRoutes() {

    // getting params of the route
    const route = useParams()

    // getting the collections and calculators choosen in the url
    const collections = Collections.find({ searchQuery: route.searchText, changeUrl: 'collections', briefDescription: 150, sort: true })
    const calculators = Calculators.find({ searchQuery: route.searchText, changeUrl: 'calculators', briefDescription: 150, removeComponent: true, sort: true })

    return (
        <>
            {/* overriding document head */}
            <Helmet>
                <title>{componentContent[languageHelper.getLanguageSymbol()].title} | Math with Science</title>
                <meta name="description" content={componentContent[languageHelper.getLanguageSymbol()].description} />
                <meta name="keywords" content="math with science, math, science, online calculator, search for calculators and collections" />

                <meta property="og:title" content={`${componentContent[languageHelper.getLanguageSymbol()].title} | Math with Science`} />
                <meta property="og:description" content={componentContent[languageHelper.getLanguageSymbol()].description} />
                <meta property="og:url" content={window.location.href} />
            </Helmet>


            {/* claculators */}
            <div className="search long-element" dir={languageHelper.getDirection()}>

                {/* collections list */}
                <ListView
                    header={{
                        title: componentContent[languageHelper.getLanguageSymbol()].title,
                        description: componentContent[languageHelper.getLanguageSymbol()].description
                    }}
                    list={[...collections, ...calculators]}
                />

            </div>
        </>
    )

}
