All files / applications/go-by-transit/src/view/nearby/components SearchRadiusSelection.tsx

100% Statements 3/3
100% Branches 11/11
100% Functions 2/2
100% Lines 3/3

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                              218x 218x                       1744x                
import { Select } from "@wintermuted/ui-react";
import React from "react";
import FontAwesome from "react-fontawesome";
 
export interface SearchRadiusSelectionParams {
  radiusSize: number;
  handleRadiusSelectionChange: React.ChangeEventHandler<HTMLSelectElement>;
  compact?: boolean;
}
 
export function SearchRadiusSelection({
  radiusSize,
  handleRadiusSelectionChange,
  compact = false
}: SearchRadiusSelectionParams) {
  const options = [250, 500, 750, 1000, 1500, 2000, 2500, 5000];
  return (
    <label className={compact ? "transit-map-radius" : undefined} htmlFor="nearby-search-radius">
      {compact && <FontAwesome name="bullseye" aria-hidden="true" />}
      {compact && <span className="wm-sr-only">Search radius</span>}
      <Select
        id="nearby-search-radius"
        aria-label={compact ? "Search radius" : undefined}
        className={compact ? "transit-map-radius-select" : undefined}
        value={radiusSize}
        onChange={handleRadiusSelectionChange}
      >
        {options.map(option => (
          <option key={option} value={option}>
            {option.toLocaleString("en-US")} ft
          </option>
        ))}
      </Select>
    </label>
  );
}