diff --git a/app/package.json b/app/package.json index c44f0dd..86b4227 100644 --- a/app/package.json +++ b/app/package.json @@ -30,6 +30,7 @@ "react-responsive": "^9.0.2", "react-router-dom": "^6.4.5", "react-scripts": "5.0.1", + "react-select": "^5.8.0", "styled-components": "^5.3.6", "typescript": "^4.4.2", "web-vitals": "^2.1.0" diff --git a/app/src/components/ContextPane.tsx b/app/src/components/ContextPane.tsx index 675fb35..ba6d242 100644 --- a/app/src/components/ContextPane.tsx +++ b/app/src/components/ContextPane.tsx @@ -4,6 +4,7 @@ import { faEye, faEyeSlash, faCircleInfo } from '@fortawesome/free-solid-svg-ico import Dropdown from './ui/Dropdown'; import { Cities } from '../libs/cities'; import { RouteRecord } from '../hooks/useAvailableRoutes'; +import Select from './ui/Select'; type Props = { availableProperties: Set; @@ -45,22 +46,14 @@ function ContextPane({ className="bg-white w-full min-w-fit h-fit shadow flex flex-col sm:overflow-y-hidden sm:h-full sm:max-w-sm sm:w-1/5" >
- + options={cities ? cities.map(r => ({value: r.display_name, label: r.display_name})) : []} + />
diff --git a/app/src/components/ui/Select/index.tsx b/app/src/components/ui/Select/index.tsx new file mode 100644 index 0000000..b740c84 --- /dev/null +++ b/app/src/components/ui/Select/index.tsx @@ -0,0 +1,31 @@ +import type { ReactNode } from "react"; +import ReactSelect from 'react-select'; + +type Props = { + children?: ReactNode; + className?: string; + onChange?: (e: any) => void; + defaultValue: string, + options: Array +}; + +export default function Select({ + children, + className, + onChange, + defaultValue, + options +}: Props): JSX.Element { + + return ( + + ); +}