sparkletown/sparkle

View on GitHub
src/components/atoms/SortDropDown/SortDropDown.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from "react";
import {
  Dropdown as ReactBootstrapDropdown,
  DropdownButton,
} from "react-bootstrap";

import { SortingOptions } from "utils/venue";

import "./SortDropDown.scss";

interface SortDropDownProps {
  onClick: (value: SortingOptions) => void;
  title: string;
}

export const SortDropDown: React.FC<SortDropDownProps> = ({
  onClick,
  title,
}) => (
  <div className="SortDropDown">
    <DropdownButton variant="secondary" title={title}>
      {Object.values(SortingOptions).map((sortingOption) => (
        <ReactBootstrapDropdown.Item
          key={sortingOption}
          onClick={() => onClick(sortingOption)}
        >
          {sortingOption}
        </ReactBootstrapDropdown.Item>
      ))}
    </DropdownButton>
  </div>
);