31 lines
679 B
JavaScript

import React from "react"
import PropTypes from "prop-types"
import { List } from "immutable"
export const PolochonSelect = ({
value,
changeValue,
polochonList,
}) => {
return (
<select
className="form-control"
value={value}
onChange={(e) => changeValue(e.target.options[e.target.selectedIndex].value)}
>
{polochonList.map((el, index) => (
<option
value={el.get("id")}
key={index}>
{el.get("name")} ({el.get("url")})
</option>
))}
</select>
);
}
PolochonSelect.propTypes = {
value: PropTypes.string,
changeValue: PropTypes.func,
polochonList: PropTypes.instanceOf(List),
};